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