[dtrace-discuss] dpp(1) - a modest proposal
Rich Morin
rdm at cfcl.com
Tue Dec 18 21:15:57 PST 2007
Peculiarly, in my rather extensive use of cpp with D, I hadn't
even _considered_ the issue of using it to import and process
*.h files. Obviously, my needs are rather out of the mainstream!
The way I got into all of this was that Leopard's -C option failed
me, so I started running cpp(1) as a separate step. Given that I
was doing some rather baroque things with macros, being able to see
the expanded form of the code was quite handy.
Then, however, I ran into the facts that (a) the Leopard cpp is not
by any means standard (and I had been relying on some non-standard
behavior :-/) and (b) Solaris can't be relied upon to have cpp or
even cc on its $PATH. (Interested parties are welcome to peruse my
workaround code in DT_Logger-0.2.tgz, as mentioned previously.)
In retrospect, I'm not sure that cpp was necessarily the best choice
as a preprocessor for the sorts of things I'm doing. I started out
using it because it was there (and because I needed some way to make
my code a bit shorter and cleaner). I may also have thought that,
by choosing cpp, I was making my code easier for others to read.
In any case, I intend to give the issue some serious thought, as I
work further on DT_Logger. Perhaps I need a "program generator" of
some sort; certainly that could make my code substantially shorter!
At 10:42 -0500 12/18/07, James Carlson wrote:
> Would you need that feature in dpp if D itself had string pasting?
If changes to D itself are under consideration, here are a couple of
wish list items:
* compile-time string concatenation
"foo" + "bar" => "foobar"
Although, to be honest, my main motivation for wanting this is
the fact that adding a %s to my printf's for the variable name
caused my programs to run out of kernel space. If Leopard had
a way to increase this space, I might not have cared.
* more flow-control constructs (if, case, ...)
I'm not asking for looping, guys, just decent alternation...
At 10:42 -0500 12/18/07, James Carlson wrote:
> What other preprocessor features are specific to D rather than C?
I'm not sure, but I'll give it some thought.
-r
--
http://www.cfcl.com/rdm Rich Morin
http://www.cfcl.com/rdm/resume rdm at cfcl.com
http://www.cfcl.com/rdm/weblog +1 650-873-7841
Technical editing and writing, programming, and web development
More information about the dtrace-discuss
mailing list