Are preprocessors necessary?

This is a discussion on Are preprocessors necessary? within the C++ Programming forums, part of the General Programming Boards category; using #defines when you can instead be using constants and inline functions will cause you no end of grief eventually. ...

  1. #16
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    using #defines when you can instead be using constants and inline functions will cause you no end of grief eventually. If you prefer it then you deserve all the debugging hours you get.Ill be in the pub!
    Another big use for the preprocessor is conditional compilation which allows you to build one source that targets many different platforms.
    The preprocessor is a necessary evil in c++ but its "bugginess" need not be a problem with careful and judicious use. Never prefer #defines to constants and never prefer macros to inline functions and you wont go far wrong.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  2. #17
    Registered User
    Join Date
    Dec 2002
    Posts
    162
    yup, agree
    Last edited by Aidman; 01-05-2003 at 06:50 PM.
    We haven't inherited Earth from our parents; instead we have borrowed her from our children - old Indian saying.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Header file multiple inclusion question
    By Loctan in forum C++ Programming
    Replies: 16
    Last Post: 05-04-2008, 08:25 PM

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