Results 1 to 12 of 12

Thread: 'QChar::QChar(ushort) noexcept': member function already defined or declared

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,332
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    317
    Thanked 871 Times in 858 Posts

    Default Re: 'QChar::QChar(ushort) noexcept': member function already defined or declared

    Not exactly. The change you suggested only comes into play when someone -uses- the header containing the QChar constructor. In that case library still contains code with an inconsistent definition of wchar_t. The change to the Qt sources affects not only the use of the header but the library build itself so that everything is now internally and externally consistent.

    In any case, if the size and layout of wchar_t and ushort are the same regardless of the compiler flag, it probably doesn't make any difference in fact. I do know that if you try to mix stdlib code (particularly std:: wstring) with QString code where Qt was compiled with a different version of the flag from the code that uses wstring, you get link-time errors because the mangled names of the functions do not match.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanked 86 Times in 81 Posts

    Default Re: 'QChar::QChar(ushort) noexcept': member function already defined or declared

    It's an inline ctor, you won't find any code inside the Qt library for it...
    /edit: therefore it will even work when you compile Qt with /Zc:wchar_t- and your lib with /Zc:wchar_t+ or the other way round.

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,332
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    317
    Thanked 871 Times in 858 Posts

    Default Re: 'QChar::QChar(ushort) noexcept': member function already defined or declared

    OK, I guess because this is a non-virtual method, it is resolved statically at compile-time and thus has no effect on either the class layout or the vtable. If the library is compiled with the code in place, it will generate a reference to a method that is never called externally by a caller using code compiled with the constructor commented out.

    It is still hard for me to believe you can mix and match code from Qt, an app, and third-party libraries using different values for the flag and not end up getting into trouble somewhere.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Convert char to QChar?
    By davinciomare in forum Newbie
    Replies: 2
    Last Post: 12th October 2016, 09:38
  2. Convert QString to QChar
    By davinciomare in forum Newbie
    Replies: 1
    Last Post: 12th October 2016, 09:36
  3. integer to QChar
    By saman_artorious in forum Qt Programming
    Replies: 1
    Last Post: 26th February 2013, 17:12
  4. From QString to QChar
    By bunjee in forum Qt Programming
    Replies: 1
    Last Post: 31st May 2009, 03:14
  5. size of QChar
    By babu198649 in forum Newbie
    Replies: 5
    Last Post: 4th August 2008, 15:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.