Preprocessor

This is a discussion on Preprocessor within the C++ Programming forums, part of the General Programming Boards category; I was wondering, is the preprocessor the device that handles comment striping? For example, does the preprocessor turn this: Code: ...

  1. #1
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870

    Preprocessor

    I was wondering, is the preprocessor the device that handles comment striping? For example, does the preprocessor turn this:
    Code:
    int a = 0; //A comment.
    Into this:
    Code:
    int a = 0;
    If not, what device does?
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    It seems so. To see the preprocessed code, use -E compiler option for GCC. (Don't know about others.)

  3. #3
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Yep, I guess it does. Thanks!
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  4. #4
    Registered User
    Join Date
    Jun 2006
    Posts
    29
    it does more than that. it prepares the code for proccessing - it includes comment striping, but it does more. for example, every line that starts with a # is a preprocessor directive.

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    In the classic description of the compilation process, the pp is responsible for comment stripping (and white space collapsing and and and ...). Actually, though, most compilers can handle comments directly, too. For example, gcc can accept .i files as input (preprocessed C), and as far as I know those may contain comments.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #6
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    I know it does more, I just wanted to know specificaly about the comment striping.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C/C++ preprocessor directives
    By coletek in forum C++ Programming
    Replies: 11
    Last Post: 01-11-2009, 03:24 PM
  2. Writing an HTML Preprocessor
    By thetinman in forum C++ Programming
    Replies: 1
    Last Post: 09-17-2007, 08:01 AM
  3. Preprocessor Directives Problem
    By MipZhaP in forum C++ Programming
    Replies: 6
    Last Post: 02-18-2005, 12:53 PM
  4. Preprocessor string pasting fun
    By ggambett in forum C Programming
    Replies: 6
    Last Post: 11-11-2004, 05:40 PM
  5. Preprocessor Functions
    By mart_man00 in forum C Programming
    Replies: 2
    Last Post: 01-09-2003, 08:58 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21