global const variable not getting assigned properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have the following global const defined at the top of a .cpp file:

const wchar_t * FILESPEC	= L"filespec";
const unsigned int LEN_PATH = 5  + wcslen(FILESPEC) ;


Then in a class method I reference LEN_PATH:

printf("The length is %d\n", LEN_PATH);

LEN_PATH is 0 (zero).  If I don't use the wide character version (change wchar_t to char and wcslen to strlen) then it works, I get LEN_PATH set to 13.  Also, if I just assign LEN_PATH = 5 or LEN_PATH = 5 + 8, then it also works.

Any idea why it is 0 when using wcslen?  And any idea why I'm not even getting an error to notify me of the problem?

Thanks!


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux