Hello together!
I'm currently poking around in the NDK headers very much and I noted a small inconsistency in the declaration of one type.
The declaration is the following in include\ndk\rtltypes.h:
==== source begin ====
typedef struct RTL_DRIVE_LETTER_CURDIR { USHORT Flags; USHORT Length; ULONG TimeStamp; UNICODE_STRING DosPath; } RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
==== source end ====
Shouldn't it be "_RTL_DRIVE_LETTER_CURDIR" instead of "RTL_DRIVE_LETTER_CURDIR"?
I don't know what influences this missing underscore has on compilation and such, cause I can read C without big problems and write a bit as well, but I don't understand every single bit a C compiler does ^^
Regards, Sven
Sven Barth pascaldragon@googlemail.com wrote:
Shouldn't it be "_RTL_DRIVE_LETTER_CURDIR" instead of "RTL_DRIVE_LETTER_CURDIR"?
It doesn't matter if you just define a variable using this structure like "RTL_DRIVE_LETTER_CURDIR MyVariable;".
It just matters if you somewhere declare it as "struct RTL_DRIVE_LETTER_CURDIR MyVariable;". If this isn't done anywhere, we could even create an anonymous structure (Microsoft extension to the C language) by defining the structure as "typedef struct {...} RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;"
But as all headers out there seem to define it as "typedef struct RTL_DRIVE_LETTER_CURDIR", we should do as well to ensure compatibility with all applications using the structure :-)
Cheers,
Colin
On 13.11.2010 19:22, Colin Finck wrote:
Sven Barth pascaldragon@googlemail.com wrote:
Shouldn't it be "_RTL_DRIVE_LETTER_CURDIR" instead of "RTL_DRIVE_LETTER_CURDIR"?
It doesn't matter if you just define a variable using this structure like "RTL_DRIVE_LETTER_CURDIR MyVariable;".
It just matters if you somewhere declare it as "struct RTL_DRIVE_LETTER_CURDIR MyVariable;". If this isn't done anywhere, we could even create an anonymous structure (Microsoft extension to the C language) by defining the structure as "typedef struct {...} RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;"
But as all headers out there seem to define it as "typedef struct RTL_DRIVE_LETTER_CURDIR", we should do as well to ensure compatibility with all applications using the structure :-)
It just caught my eye cause every other struct definition in the ReactOS headers (that I've seen so far) is named with a leading underscore...
But thank you for your explanation why this isn't a problem.
Regarding the anonymous structure: wouldn't this break compatibility with gcc? (I don't know what features gcc supports ^^)
Regards, Sven
Sven Barth pascaldragon@googlemail.com wrote:
Regarding the anonymous structure: wouldn't this break compatibility with gcc? (I don't know what features gcc supports ^^)
Anonymous structures are fully supported by GCC when using the flag -fms-extensions. We have it enabled throughout the whole codebase.
Colin
...and what about cmake? ´cos we are moving from gcc to cmake....
On Sat, Nov 13, 2010 at 7:44 PM, Colin Finck mail@colinfinck.de wrote:
Sven Barth pascaldragon@googlemail.com wrote:
Regarding the anonymous structure: wouldn't this break compatibility with gcc? (I don't know what features gcc supports ^^)
Anonymous structures are fully supported by GCC when using the flag -fms-extensions. We have it enabled throughout the whole codebase.
Colin
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
Hi,
GCC is a compiler. CMAKE is a build system we use with... GCC (for the moment). So no point in the question.
Best regards, P. Schweitzer
...and what about cmake? ´cos we are moving from gcc to cmake....
On Sat, Nov 13, 2010 at 7:44 PM, Colin Finck mail@colinfinck.de wrote:
Sven Barth pascaldragon@googlemail.com wrote:
Regarding the anonymous structure: wouldn't this break compatibility with gcc? (I don't know what features gcc supports ^^)
Anonymous structures are fully supported by GCC when using the flag -fms-extensions. We have it enabled throughout the whole codebase.
Colin
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
ah.. ok sorry
On Sat, Nov 13, 2010 at 8:45 PM, Pierre Schweitzer < pierre.schweitzer@reactos.org> wrote:
Hi,
GCC is a compiler. CMAKE is a build system we use with... GCC (for the moment). So no point in the question.
Best regards, P. Schweitzer
...and what about cmake? ´cos we are moving from gcc to cmake....
On Sat, Nov 13, 2010 at 7:44 PM, Colin Finck mail@colinfinck.de wrote:
Sven Barth pascaldragon@googlemail.com wrote:
Regarding the anonymous structure: wouldn't this break compatibility with gcc? (I don't know what features gcc supports ^^)
Anonymous structures are fully supported by GCC when using the flag -fms-extensions. We have it enabled throughout the whole codebase.
Colin
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
On 13.11.2010 19:44, Colin Finck wrote:
Sven Barth pascaldragon@googlemail.com wrote:
Regarding the anonymous structure: wouldn't this break compatibility with gcc? (I don't know what features gcc supports ^^)
Anonymous structures are fully supported by GCC when using the flag -fms-extensions. We have it enabled throughout the whole codebase.
Ok, thanks again :)
Regards, Sven
Colin Finck wrote:
Sven Barth pascaldragon@googlemail.com wrote:
Shouldn't it be "_RTL_DRIVE_LETTER_CURDIR" instead of "RTL_DRIVE_LETTER_CURDIR"?
It doesn't matter if you just define a variable using this structure like "RTL_DRIVE_LETTER_CURDIR MyVariable;".
It matters from a debugging perspective. The symbols store the struct name, not the typedef. Anyone expecting to dump data based on the data type with an underscore would get an error on reactos.
I've just had a look at win7:
0: kd> dt ntdll!RTL_DRIVE_LETTER_CURDIR Symbol ntdll!RTL_DRIVE_LETTER_CURDIR not found. 0: kd> dt ntdll!_RTL_DRIVE_LETTER_CURDIR +0x000 Flags : Uint2B +0x002 Length : Uint2B +0x004 TimeStamp : Uint4B +0x008 DosPath : _STRING
So we actually break compatibility with Windows by not copying struct names exactly. This is indeed a typo that needs fixing.
Ged.