Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Standard library `FILE` type [duplicate]

Tags:

c

Possible Duplicate:
Why is FILE all-caps as in FILE*?

Why is the standard library FILE type written uppercase ?
Is it because of its opaque nature ?

Thank you.

like image 694
lledr Avatar asked Sep 08 '11 13:09

lledr


2 Answers

If you look at the naming convention used in C, upper case is typically used for preprocessor macros. My guess is that it originally was implemented as a macro expanding to the concrete type used by the library implementation.

like image 89
Lindydancer Avatar answered Sep 30 '22 11:09

Lindydancer


From here

"Strictly speaking, in C the FILE type is a library defined (in stdio.h header) type alias (see typedef keyword). No need to use FILE type as such, only FILE* (pointer to FILE) type. It's (one of;) C language funny idioms. As usually, FILE type alias denotes library defined structure, but don't use its members directly (it's implementation dependent entity)."

Also this:

typedef FILE *stream;

Finally here:

like image 30
N_A Avatar answered Sep 30 '22 10:09

N_A