Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why would C files end in /*[]*/

Tags:

c

coding-style

I am looking through some proprietary source code: sample programs in using a library.

The code is written in C and C++, using make for build system.

Each and every file ends in a commented out []: /*[]*/ for source files and #[]# for makefiles. What could be the reason for this?

The code is compiled for ARM with GCC, using extensions.

like image 627
Vorac Avatar asked Oct 22 '13 13:10

Vorac


People also ask

What is at the end of a file in C?

The End of the File (EOF) indicates the end of input. After we enter the text, if we press ctrl+Z, the text terminates i.e. it indicates the file reached end nothing to read.

When file ends with the last character the pointer reaches to?

The feof() function detects the end-of-file character. It returns a non-zero value (that is, a TRUE) if the file pointer is at the end of a file, else a 0 is returned.

What is the use of EOF ()?

Use EOF to avoid the error generated by attempting to get input past the end of a file. The EOF function returns False until the end of the file has been reached. With files opened for Random or Binary access, EOF returns False until the last executed Get statement is unable to read an entire record.

Why is there a line break at the end of a file?

Because that's how the POSIX standard defines a line: 3.206 Line. A sequence of zero or more non- <newline> characters plus a terminating <newline> character. Therefore, lines not ending in a newline character aren't considered actual lines.


1 Answers

It is most likely a place holder for some sort of automatic expansion.

Typically something like macrodef (or one of the source code control filters) would expand such items to contain some relevant text. As typically only the comment-protected brackets would expand, the comments would remain in place, protecting the source code from actual expanded items at compilation time.

However, what you are currently looking at is probably the outer containing brackets with all of the internal expansions removed. This may have been done during a code migration from one source code control system to another. Although such an idea is highly speculative, it does not appear that they took the effort to migrate expansion items, instead of just removing them.

like image 107
Edwin Buck Avatar answered Oct 03 '22 19:10

Edwin Buck