Using #include with no filename

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is probably very basic but I'm going to ask anyway:

 

While searching the freaks forums for various answers to other questions, I've seen code snippets where the author would have a #include inserted in a C source file but no filename.h.  I didn't know such a construct was allowed.  I searched the GCC documentation but didn't see where this particular format was described.

I would appreciate it if someone would enlighten me as to proper usage and benefits.  Maybe I misinterpreted the code snippets that I was reading.

 

Thanks

Jim

Last Edited: Mon. Apr 24, 2017 - 10:11 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Perhaps the OP scrubbed the file path because he or she did not want to reveal too much about the computer or the project? Just a guess.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rfdes wrote:
I've seen code snippets where the author would have a #include inserted in a C source file but no filename.h.
You mean something like this:

#include CONF

rfdes wrote:
I searched the GCC documentation but didn't see where this particular format was described.
Because it is no "particular format", it is ordinary preprocessor macro expansion.

 

If you are talking about something different, then give a concrete example.

Stefan Ernst

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Isn't this just the old & well-known forum bug that "swallowed" anything between < angle brackets > ??

 

EDIT

 

See: https://www.avrfreaks.net/forum/i...

 

Further Edit

 

Especially #7 - with a tip on how to see the original code: https://www.avrfreaks.net/comment...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Mon. Apr 24, 2017 - 10:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Isn't this just the old & well-known forum bug that "swallowed" anything between < angle brackets > ??
+1

 

It horrifies me that I often refer people back to old posts I have made and when I search them out I see the forum has made them completely senseless because the code starts with a sequence like:

#include
#include
#include

int main(void) {
    ...

The forum software has, indeed, "eaten" the <something.h> entries because it read the '<' and '>' as HTML tags :-(

 

@rfdes if you see examples of this then go to legacy.avrfreaks.net and see if you can find the "old copy" of the same thread where the layout/formatting will not have been corrupted.