some strange code. please help!

This is a discussion on some strange code. please help! within the C Programming forums, part of the General Programming Boards category; here is the code I came across recently Code: int _tmain(int argc, _TCHAR* argv[]) _tmain??? _TCHAR * ??? what do ...

  1. #1
    C/C++Newbie Antigloss's Avatar
    Join Date
    May 2005
    Posts
    212

    some strange code. please help!

    here is the code I came across recently
    Code:
    int _tmain(int argc, _TCHAR* argv[])
    _tmain??? _TCHAR * ??? what do those strange things mean??

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    MSDN sez: You can also use _tmain, which is defined in TCHAR.h. _tmain will resolve to main unless _UNICODE is defined, in which case _tmain will resolve to wmain.

    And somewhere in the depths of the windows headers, I would presume that _TCHAR is typedef'd as just a primitive char, unless _UNICODE is defined in which case it would resolve to a unicode wide character. This is all just VC++ Microsoft specific stuff I guess, just for ASCII and unicode wide char support extensions.
    Last edited by Tonto; 08-15-2005 at 06:38 PM. Reason: Dunno.

  3. #3
    C/C++Newbie Antigloss's Avatar
    Join Date
    May 2005
    Posts
    212
    Quote Originally Posted by Tonto
    This is all just VC++ Microsoft specific stuff I guess, just for ASCII and unicode wide char support extensions.
    So it means that _tmain and _TCHAR are not Standard C, and they are not portable, right?

  4. #4
    C/C++Newbie Antigloss's Avatar
    Join Date
    May 2005
    Posts
    212
    Could somebody give me a conformation? Please.

  5. #5
    Registered User
    Join Date
    Jun 2005
    Posts
    6,157
    _tmain and _TCHAR are not standard C

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,417
    > So it means that _tmain and _TCHAR are not Standard C, and they are not portable, right?
    Exactly, but as another poster mentioned, it allows you to switch on and off UNICODE support much more easily.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Proposal: Code colouring
    By Perspective in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 05-14-2007, 07:23 AM
  2. Obfuscated Code Contest: The Results
    By Stack Overflow in forum Contests Board
    Replies: 29
    Last Post: 02-18-2005, 04:39 PM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 03:17 PM
  4. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 03:28 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21