Beginning C programming- exceptions to whitespace irrelevant? include directive
New to programming. In several texts and online resources I have read that whitespace is irrelevant in C (except of course with strings).
Today I ran across the fact that my compiler choked on the following form of an include directive: Code:
#include < stdio.h> Any other exceptions to "whitespace irrelevant" you know of? I'm using Debian with current gcc. Thanks, Keith Ostertag |
Hi there,
Quote:
Quote:
Anyway ... In your example, the < and > characters are considered string delimiters, and so the contents they enclose is a string. Note that you may use quotes instead of the < > and then you wouldn't have seen this as an exeption, would you? However, there is a difference between using quotes and angle brackets with #include. If you use angle brackets, the compiler searches for the included file in its pre-configured include directories. If you use quotes, it searches in the source file's directory first, and then in the include directories. [X] Doc CPU |
Thank you for an informative response!
|
You might like the GNU C Preprocessor and the GNU C Reference Manual. For actual mastery you can get final draft standards free at www.open-std.org. Wrapping your head around the structure and detail of tho standards demands the kind of thinking that will serve you _very_ well professionally, but don't try them until you feel you have a real idea of what compilers and linkers and loaders do.
|
All times are GMT -5. The time now is 10:23 AM. |