Welcome, Guest. Please login or register.

Author Topic: #line directive debugging vs boost preprocessor library...  (Read 3075 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2871
    • Show all replies
I was reading through the boost library docs about their preprocessor library and it seems that the only valuable argument they present for people to use it over building their own custom code generator is that users would have to integrate it in their development environment and there would have to be various builds for various platforms, contrarily to the preprocessor wich already exists and should work in most C compliant preprocessors, given enouph care.

But the other day I was debugging some of my own macros and checking the preprocessor output from some compilers when all of a sudden it got me. A custom made code that would interpret custom keywords in the source (custom macro preprocessor) could be integrated simply using the #line directive wich seems to have been tailored specifically to this task!! Using it would allow line numbers to appear correctly on compiler messges.
My C book actually mentions that the #line directive is intended for debugging purposes. Must be the same use here: some utility that analised a source could actually use the #line and #error directives to make the compiler display errors regarding any line it wanted.

SO now I'm left with a big doubt. Surely there must be some advantages to using the boost preprocessor library (and preprocessor macros in general) otherwise the boost devs wouldn't have gone through all the trouble of creating it ? Or is it just that if there's an alternative way to do things, some people will try it anyway, even if it's worse ?

:pint:
\\"We made Amiga, they {bleep}ed it up\\"
 

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2871
    • Show all replies
Re: #line directive debugging vs boost preprocessor library...
« Reply #1 on: May 26, 2007, 03:00:23 PM »
Who would've wrote that  ;-) I actually don't regret having pushed it a bit more on this one, as I've found the boost preprocessor is used among C++ coders too for metaprograming. Apparently templates don't solve all problems.
I'd also face the problem that the C++ library is more bulky and would make my code slower and bigger (AFAIK), at least for smaller projects.
\\"We made Amiga, they {bleep}ed it up\\"