Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Because it doesn't work very well. In particular, the C preprocessor doesn't know Perl syntax. Take this tiny example and save it into

#define FOO "bar" print qq(The value of FOO is "), FOO, qq("\n);
and then try it out:
$ perl The value of FOO is "FOO" $ perl -P The value of "bar" is "FOO" $
It expands it when it shouldn't and doesn't when it should.

I expect that you could get many C preprocessors to choke or issue warnings on fairly common Perl syntax as well.

This is enough of a reason for me to not use such a trick. There are several other good reasons to not use this given in the thread. One of which I ran into just trying to demonstrate how my tiny example fails. First, on Win32 even with MS VC++ installed:

> perl -P 'cl' is not recognized as an internal or external command, operable program or batch file. > vcvars32 Setting environment for using Microsoft Visual C++ tools. > perl -P Command line error D2003 : missing source filename >
Random Unix box:
$ perl -P ngcc: -: No such file or directory ngcc: No input files specified. $

                - tye

In reply to Re: C pre-processor in Perl (breaks) by tye
in thread C pre-processor in Perl by dragonchild

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2021-06-24 15:10 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (128 votes). Check out past polls.