While porting a C++ Program from 32 to 64 bit under windows I realized _tcslen is not supported and instead strlen/wcslen (for non-unicode/unicode) should be used. I started to wonder
- If wcslen is part of the ISO/IEC 14882:2003 C++ standard library. I see this function is supported both by g++ as well as VC++. Also in open group I found a reference stating
The functionality described on this reference page is aligned with the ISO C standardbut didn’t mention if its C89 or c99. - Is it documented somewhere that _tcslen is not compatible with Win64? Even the MSDN Link doesn’t hint a thing.
- For Unicode can wcslen be used inadvertently instead of _tcslen?
wcslenas one of the functions declared in<cwchar>._tcslenis also available when doing x64 builds._UNICODEis defined then_tcslenexpands towcslen. The only thing you gain by using_tcslenis that theoretically you can make an ANSI build of your application by flipping a switch; practically there is nothing you stand to gain from this (ANSI builds in 2012 are simply atrocious IMHO) and it takes actual work to make your build work both ways. I would not recommend it.