Thread: Preprocessor Question/s

  1. #1
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733

    Preprocessor Question/s

    I tried googling it but didn't notice any results that would've answered my question (even tried looking at Wikipedia)

    I wanted to know if there is any preprocessor commands/queries that naturally expand across more than one line (and I don't mean #if etc which if you dis-include the code are still naturally one line)

    As far as I can think of there are none
    Code:
    #undef <ID>
    #define <ID>
    #ifdef <ID>
    #if <EXPR>
    #elif <EXPR>
    #else
    #endif
    #pragma <CC_ACTION>
    #include <INC>
    #import <INC>
    I'm asking because it determines the complexity of my project

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Would you count the use of \ to extend a #define macro across multiple lines?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Quote Originally Posted by laserlight View Post
    Would you count the use of \ to extend a #define macro across multiple lines?
    Nah, I count that as a single 'line' I mean examples like this from make:
    Code:
    build: $(objects)
      $(cc) -o $(out) $(objects)
    Where the syntax expects at least one extra line to be correct (I'm aware that particular example could take one line but I could not think of a better example off the top of my head)

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Then no, by definition all preprocessing directives are contained within a single logical line.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Oh good, then I can make my code simpler then

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 03-06-2018, 09:11 PM
  2. preprocessor
    By Saurabh Mehta in forum C Programming
    Replies: 2
    Last Post: 03-11-2013, 11:53 PM
  3. Preprocessor ?
    By ZK57 in forum C Programming
    Replies: 2
    Last Post: 03-09-2013, 06:09 PM
  4. C Preprocessor Macro Question
    By mwpierce in forum C Programming
    Replies: 3
    Last Post: 12-09-2011, 11:34 AM
  5. Preprocessor question
    By fraujansen in forum C++ Programming
    Replies: 0
    Last Post: 12-20-2010, 02:00 PM

Tags for this Thread