Hi!
i386-mingw32-gcc -D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0501 -I./include -DUNICODE -D_UNICODE -D__REACTOS__ -D__USE_W32API -D_HIDPI_ -D_HIDPI_NO_FUNCTION_MACROS_ -Wall -Werror -fno-builtin -I. -I../../include -I../../w32api/include -pipe -march=i486 -D_M_IX86 -g -c hid.c -o hid.o hid.c: In function `HidD_Hello': hid.c:374: warning: duplicate `const' make: *** [hid.o] Error 1
const PCHAR const HelloString = "Hello\n"; ^ | is that right?
I'm back online! James
James Tabor wrote:
const PCHAR const HelloString = "Hello\n"; ^ | is that right?
No.
Assuming PCHAR is just a (IMO basically useless) "typedef char* PCHAR;", then "const PCHAR" would mean nothing, since you can't modify the cv-qualification of a typedef like this (cv is C and C++ standard lingo, meaning "const/volatile"). This is one of the reasons such stupid typedefs are bad - the only way to make them point to a const object is by adding yet _another_ typedef: "typedef const char* PCCHAR;" (or CPCHAR if you're into that kind of naming :-) ), or by literally using the real type the typedef refers to.
I suspect the well-meaning intention, but not equally informed wrt cv-qualification and typedefs, was:
const char* HelloString const = ...
but why anyone would do something like that instead of just
const char HelloString[] = ...
or if wanting to make the code more obscure, harder to understand and therefore less maintainable
LPCSTR const HelloString = ...
I don't understand.
-- /Mike
James Tabor wrote:
Hi!
i386-mingw32-gcc -D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0501 -I./include -DUNICODE -D_UNICODE -D__REACTOS__ -D__USE_W32API -D_HIDPI_ -D_HIDPI_NO_FUNCTION_MACROS_ -Wall -Werror -fno-builtin -I. -I../../include -I../../w32api/include -pipe -march=i486 -D_M_IX86 -g -c hid.c -o hid.o hid.c: In function `HidD_Hello': hid.c:374: warning: duplicate `const' make: *** [hid.o] Error 1
const PCHAR const HelloString = "Hello\n"; ^ | is that right?
I'm back online! James _______________________________________________ Ros-dev mailing list Ros-dev@reactos.com http://reactos.com:8080/mailman/listinfo/ros-dev
it should be right - it is a constant pointer to constant data. But i'm not 100% sure if it's just a c++ feature.
Best Regards Thomas