Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is FILE all-caps as in FILE*? [closed]

Tags:

c

history

This just seems odd to me, most other things are lower case.

Is there some historical reason?

like image 283
jm1234567890 Avatar asked Aug 04 '11 22:08

jm1234567890


People also ask

Why is file all caps C?

Most likely FILE was originally a macro, and by convention macros have all-caps names. This would have been before typedef was introduced to the C language.

Why is it Typing in all caps?

There are multiple reasons why everything may become capitalized in Microsoft Word: The Caps Lock button on the keyboard is turned on. One of the Shift keys on the keyboard has physically jammed. A font type has been selected that only has upper case letters.

Why you should not type in all caps?

While all caps can be used as an alternative to rich-text "bolding" for a single word or phrase, to express emphasis, repeated use of all caps can be considered "shouting" or irritating. Such poor netiquette has led to a number of cases involving employees being laid off for this particular reason.

Should you use capitals in file names?

Capitalize the first letter of each word in a file name. This is called “CamelCase.” It is an efficient way to differentiate words but it can be harder to read. If the file name contains a capitalized acronym, it should appear in capitals and the first letter of the following word should also be capitalized.


1 Answers

It's a macro. Macros have historically had all caps in C. Unfortunately recent trends appear to have broken that fact.

Small history lesson: Also, FILE was an io buffer abstraction in UNIX v7 libc stdio. A FILE doesn't necessarily represent a physical file, just something that can do block IO. Source:

http://www.bsdlover.cn/study/UnixTree/V7/usr/include/stdio.h.html

"file" was already defined by the kernel as well:

http://www.bsdlover.cn/study/UnixTree/V7/usr/include/sys/file.h.html

As someone else said here it's probably a typedef now, but I don't think C had typedefs back in '79 as it only just had structs. Then again I wasn't born then so... :)

like image 198
Deleted Avatar answered Sep 27 '22 19:09

Deleted