Greetings:
Since this list has expanded in scope beyond Device Drivers I feel
little guilt for asking this question…
Backround: In the good old days Just after the Autocoder period in the
early IBM 360 Assembler era :
There was macro writing support wherin certain elements were available
to the macro writer which were very sophfisticated.
ie : The count of parameters and parameter index all kinds of system
values etc etc.
I now have a unique coding problem using visual C++ 6.0 and Find the
above mentioned Good macro stuff is missing or I have missed reading the
docs well enough.
For You Compiler Wonks : Within a function is there a C keword which
contains the name of the current function being compiled
that i can use within a macro and is the parameter count into that
function available using another majic Keyword ?
C Compiler writers could learn a lot from an IBM Mainfram Assembler
Macro manual.
Thanks In Advance
If you tell us the problem you are trying to solve, instead of telling us
how the tool you have doesn’t solve it, we can maybe help you. What you
have given is a wish list of compiler features. What this list is really
good at is helping to find solutions to problems.
Phil
* Philip D. Barila | (503) 264-8386
* Intel Corp. | Not speaking for Intel
-----Original Message-----
From: Hayes, Sanford [mailto:xxxxx@livco.com]
Sent: Wednesday, October 18, 2000 4:03 PM
To: NT Developers Interest List
Subject: [ntdev] Esoteric Compiler Questions
Greetings:
Since this list has expanded in scope beyond Device Drivers I feel
little guilt for asking this question…
Backround: In the good old days Just after the Autocoder period in the
early IBM 360 Assembler era :
There was macro writing support wherin certain elements were available
to the macro writer which were very sophfisticated.
ie : The count of parameters and parameter index all kinds of system
values etc etc.
I now have a unique coding problem using visual C++ 6.0 and Find the
above mentioned Good macro stuff is missing or I have missed reading the
docs well enough.
For You Compiler Wonks : Within a function is there a C keword which
contains the name of the current function being compiled
that i can use within a macro and is the parameter count into that
function available using another majic Keyword ?
C Compiler writers could learn a lot from an IBM Mainfram Assembler
Macro manual.
Thanks In Advance
I think you’re confusing macro text processing with C style function calls.
You can write your functions in assembler and link to your C code.
Microsoft MASM and Borland TASM have all of these features available
for macros. As for true functions, even in MASM there is no feature
comparable to what you look for.
But if you like to stay in C and also use your macro skills, read all the
documentation about #define’s and ‘stringization’ and others. You can
get pretty wild with the features, but the code will became so
obfuscated that even yourself will not know how it works a month after
you stop messing with it.
The features are all in the preprocessor documentation.
HTH
George Blat
At 07:03 PM 10/18/00 -0400, you wrote:
Greetings:
Since this list has expanded in scope beyond Device Drivers I feel
little guilt for asking this question…
Backround: In the good old days Just after the Autocoder period in the
early IBM 360 Assembler era :
There was macro writing support wherin certain elements were available
to the macro writer which were very sophfisticated.
ie : The count of parameters and parameter index all kinds of system
values etc etc.
I now have a unique coding problem using visual C++ 6.0 and Find the
above mentioned Good macro stuff is missing or I have missed reading the
docs well enough.
For You Compiler Wonks : Within a function is there a C keword which
contains the name of the current function being compiled
that i can use within a macro and is the parameter count into that
function available using another majic Keyword ?
C Compiler writers could learn a lot from an IBM Mainfram Assembler
Macro manual.
Thanks In Advance
You are currently subscribed to ntdev as: xxxxx@brd.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)
George Blat
BRD Corp
8016 188th SW, Edmonds, WA 98026
phone: 425-775-7475
fax: 781-998-5940
mailto:xxxxx@brd.com
http://www.brd.com
>For You Compiler Wonks : Within a function is there a C keword which
contains the name of the current function being compiled
that i can use within a macro and is the parameter count into that
function available using another majic Keyword ?
What you may want is the compile and run-time information to be available
as data, this is typically called metadata in other languages. There are
some options to increase the amount of metadata available under C++. Not
sure if exactly what you want is available.
In a metadata rich language, like Smalltalk, you can write a statement like:
a := thisContext selector.
Which will assign the name of the currently executing method (function) to
the variable ‘a’. The reserved name ‘thisContext’ references an object that
represents the current execution context (i.e. current stack frame).
Implementations of C++ are generally not what I’d call metadata rich.
Some compilers have predefined #defines for a variety of things, like
LINE I believe is the current source code line. I’m a STRONG believer
in metadata rich languages, and tend to think languages without this are
broken.
When I think about it, you could actually use the debugging support library
(IMAGEHLP ??) to get a variety of metadata. I believe you could extract the
current program counter, and then ask the debug library what function would
contain that address. Assuming you ship your app with debugging info, you
could also query the debug library about what the parameters for your
function look like. This is not really part of the C++ language, but
offhand seems like it might work. Performance for these metadata queries
may not be pleasant though, so you might want to cache the answers. This
would be at run-time, not compile time though.
To those who replied :
Thanks for the Info on Run-time Function name / Parameter extraction
from imagehelp I can put that to good use on other projects.
However the exact problem which lead to my Query was structly a compile
time macro which would automatically plug the current function name and
parameter count into a macro to generate some debugging and performance
information capture code without individually hand coding each of these
elements for a several hundred function API (to save hours of coding
time and attendant fatigue related edit errors).
Mortal Fear of Obfuscation is exactly why my C macro skills are less
that robust 
Lastly : What compiler switches generate or make available meta-data
items at compile time in VC 6.0 ??
Thanks
Sanford Hayes
Livingston & Co. Inc.
xxxxx@livco.com
www.livco.com
Alas, I fail to see any cl commandline option that would
give you more meta-data.
I suspect this is not what you want to hear,
but you could cook up a Perl script to generate and insert the code
you want.
BTW here are some useful MS predefined macros:
DATE The compilation date of the current source file.
FILE The name of the current source file.
LINE The line number in the current source file.
TIMESTAMP The date and time of the last modification of the current
source file
best of luck…
/sG
I vaguely remember seeing something in a magazine (maybe the C/C++ User’s
Guide) about a new macro definition, FUNC or FUNCTION, which might be
part of the newer C or C++ standards (or in the process of being
standardized). I don’t know what compilers support the macro, and I think it
is different (the macro, that is) in Borland and Microsoft compilers. Good
Luck!
----- Original Message -----
From: Steve Gonczi
To: NT Developers Interest List
Sent: Thursday, October 19, 2000 8:07 PM
Subject: [ntdev] Re: Esoteric Compiler Questions
> Alas, I fail to see any cl commandline option that would
> give you more meta-data.
>
> I suspect this is not what you want to hear,
> but you could cook up a Perl script to generate and insert the code
> you want.
>
> BTW here are some useful MS predefined macros:
>
> DATE The compilation date of the current source file.
>
> FILE The name of the current source file.
>
> LINE The line number in the current source file.
>
> TIMESTAMP The date and time of the last modification of the current
> source file
>
>
> best of luck…
>
> /sG
>
> —
> You are currently subscribed to ntdev as: xxxxx@midcore.com
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>