Re: __VA_ARGS__ and the DDK compiler

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I see. Well in this case there will be no way to accomplish this, because I
wanted to do something like the following:

#define OUT( format, ... ) DbgPrint( __FILE__ "(%4.4d) - " __FUNCTION__ ": "
format, __LINE__, __VA_ARGS__ )

My attempts I did before posting to use as __inline or __forceinline
declared functions with __LINE__ etc. macros inside the inlined function
scope resulted in very odd Outputs - negativ file numbers and other stuff.

So I guess it is impossible.

Another question on my mind is, why does the

#line LineNum "FileName"

directive uses an offset of 2 for LineNum?
Since I coud not figure out a way to deactivate what would be the (I think)
/FC switch in VC++ do reduce the __FILE__ output from path\filename to
filename (which is the default in VC++), I am using the #line directive to
set the filename manualy. Consulting the MSDN I expected the following to
work properly (asuming it has been written in the first line of the source
code file):

#line 1 "driver.cpp"

What i figured out with DbgView was, that this would actually move the line
by -1. I solved that now in writing:

#line 2 "driver.cpp"

in the first source code line.
I would be interested in knowing why its working like that and if there is
some kind of hidden source code line which is inserted by the build tools
internally?

Thanks.

Laurents C. R. Meyer
SEALOG

"Mark Roddy" wrote:

> Laurents C. R. Meyer wrote:
> > I find using __VA_ARGS__ in macros very powerful. I am working some debugging
> > code over and would like to use __VA_ARGS__ but until now I was not able to
> > make the build environment compile it without errors.
> >
> > Does anybody know if there is a compiler switch I have to turn on?
> >
> > Laurents C. R. Meyer
> > SEALOG
> Visual C does not support the C99 standard. Try using inline functions
> instead.
>
> --
>
> =====================
> Mark Roddy DDK MVP
> Windows 2003/XP/2000 Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
>
.



Relevant Pages

  • Re: __VA_ARGS__ and the DDK compiler
    ... compilers than to driver development, ... > some kind of hidden source code line which is inserted by the build tools ... >> Laurents C. R. Meyer wrote: ...
    (microsoft.public.development.device.drivers)
  • Re: Characters allowed in short filenames
    ... the source code of the CheckNameLegalDOS8Dot3 API is the documentation of what characters are allowed in short filenames. ... even attempt to discuss what is valid in any OEM code page in the short name stored on the device. ... fatgen103.doc seems to have a slightly below average proportion of bugs, but Windows doesn't completely agree with it. ... > page is 850 then we are halfway towards allowing a short filename> to ...
    (microsoft.public.development.device.drivers)
  • Re: Attachment problem
    ... Take at look at the source code for that message by pressing Ctrl-F3. ... Does it show the filename of the attachment? ... In the security tab I have cleared the "Do not allow attachments to be saved or opened..." ...
    (microsoft.public.windows.vista.mail)
  • Re: WDM Serial Port On Win98/ME
    ... Write your driver to be below CCPORT. ... "Laurents C. R. Meyer" wrote ... > Laurents C. R. Meyer ... >> Maxim Shatskih, Windows DDK MVP ...
    (microsoft.public.development.device.drivers)
  • Re: Cannot import a module from a variable
    ... for which I was very grateful. ... # Imports all the modules in the sub-directory "directory" ... for filename in uncompiled_files: ... # Add any pre-compiled modules without source code. ...
    (comp.lang.python)