C code is just text, so there are infinite ways to use Perl (or any other language with a print statement) to generate C code. The point of cpppp is to have templates that are fairly readable as C code, and output that is good enough to commit to a repo, and a collection of tools that meet common needs in authoring C. These things can be fairly awkward to do with plain old print statements, or even Template Toolkit. And, maybe more to the point, they're painful to do with C's own preprocessor, which was designed specifically for this role, and especially painful to handle with the C++ template system, which was designed to make up for the shortcomings of the preprocessor and yet still falls short, in my opinion.

Now, sometimes it looks OK to just use here-docs. But with more advanced cases it can get rather ugly. It can even get ugly just using C's preprocessor in a pure C project. I haven't gotten around to rewriting those in cpppp yet, but I assure you it will be more readable.

If you have examples of PDL making life easier in this manner, I'd be interested to see them.


In reply to Re^2: Introducing the C Perl-Powered Pre-Processor by NERDVANA
in thread Introducing the C Perl-Powered Pre-Processor by NERDVANA

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.