Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Predefined MACROs are not Implemented yet.

Reply
Thread Tools

Predefined MACROs are not Implemented yet.

 
 
Immortal Nephi
Guest
Posts: n/a
 
      02-27-2010
I examine some websites to look for predefined macros. __FILE__,
__DATE__, and __TIME__ are reserved by C/C++ Compiler. If you try to
convert them to Unicode, they are not yet implemented or they are
undefined.

#define _WIDEN2( x ) L ## x
#define _WIDEN( x ) _WIDEN2( x )
#define __WFILE__ _WIDEN( __FILE__ )
#define __WDATE__ _WIDEN( __DATE__ )
#define __WTIME__ _WIDEN( __TIME__ )

You cannot define __WFILE__, __WDATE__, and __WTIME__ because they
might be reserved and added to C/C++ Compiler in the future.
I thought that you accept alternative solution.

const std::wstring WIDEN( const char* Text )
{
std::wostringstream woss;
woss << Text;

return woss.str();
}

int main()
{
std::wstring WFILE = WIDEN( __FILE__ );
std::wcout << "File: " << WFILE << std::endl;

return 0;
}

Please let me know what you are saying your opinion.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Functions implemented as macros? Pedro Graca C Programming 5 01-20-2008 12:24 AM
C predefined macros and portability sathya_me C Programming 5 08-18-2004 11:55 AM
Explanation of macros; Haskell macros mike420@ziplip.com Python 80 11-07-2003 02:22 AM
Re: Explanation of macros; Haskell macros mike420@ziplip.com Python 5 11-01-2003 01:09 AM
Re: Explanation of macros; Haskell macros mike420@ziplip.com Python 1 10-07-2003 04:07 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57