CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2014
    Posts
    13

    Is it a bad practice not to use #define UNICODE when creating a Unicode application?

    I like to know exactly what functions I am calling so I like to write something like CreateWindowExW() and CreateFileW() and not having to use macros.
    So can I do that without using #define UNICODE, or is calling the functions by their "real" names considered a bad practice?

    Note: I am not interested in creating an ANSI version of the application.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,492

    Re: Is it a bad practice not to use #define UNICODE when creating a Unicode applicati

    If you like to type extra characters, it isn't a problem.

  3. #3
    Join Date
    Dec 2014
    Posts
    13

    Re: Is it a bad practice not to use #define UNICODE when creating a Unicode applicati

    Quote Originally Posted by Arjay View Post
    If you like to type extra characters, it isn't a problem.
    lol I don't like to type extra characters I just like to know what a function does by looking at it and not thinking that I defined this or that...
    Sometimes I use CreateFileW() and WriteFileA() in the same code, so this is better than writing CreateFile() and WriteFileA() IMHO.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,492

    Re: Is it a bad practice not to use #define UNICODE when creating a Unicode applicati

    Whatever helps you understand your code is good.

  5. #5
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: Is it a bad practice not to use #define UNICODE when creating a Unicode applicati

    the benefit of the macro's is that you can switch between ansi and unicode build.

    if you ONLY care about a unicode binary... you don't have to use the _T() macro for all strings, you don't have to use the macro version of the functions but can explicitely call the 'W variant. Nothing wrong with that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured