On Tue, Jun 18, 2002 at 01:25:49PM -0400, Melvin Smith wrote: > 1) Macros and debuggers don't play as well together.
I second that. One of my biggest barriers to useful debugging of perl5 is having, for example, an HV and having to unroll something like the SvRMAGICAL() macro to figure out if it's a magical HV. Now, there is a little trick I use in Perl with macros to get around this problem and it might work with C. $ cat ~/tmp/foo.plx #!/usr/bin/perl BEGIN { eval 'use Filter::cpp' } sub FOO { my $bar = shift; #define FOO($bar) \ "FOO has ".$bar } print FOO(42), "\n"; $ perl ~/tmp/foo.plx FOO has 42 $ perl -dw ~/tmp/foo.plx Default die handler restored. Loading DB routines from perl5db.pl version 1.07 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(/home/schwern/tmp/foo.plx:12): 12: print "FOO has ". 42 , "\n"; DB<1> x FOO(23) 0 23 DB<2> FOO() is both a macro *and* a real subroutine with a minimum of code duplication. I originally used this technique to avoid depending on Filter::cpp and a C preprocessor, but it also has the nice side effect of creating debugger friendly macros. I'm sure someone can figure out an equivalent techique for C. -- This sig file temporarily out of order.