[Development] Why can't QString use UTF-8 internally?

Olivier Goffart olivier at woboq.com
Wed Feb 11 11:11:36 CET 2015

On Tuesday 10 February 2015 17:25:07 Thiago Macieira wrote:
> On Wednesday 11 February 2015 01:59:40 Olivier Goffart wrote:
> > Unless it is a buffer of std::atomic, it is an undefined behavior, so not
> > only the contents of the buffer is unpredictable, but anything, really.
> > 
> > (A sufficiently smart conforming compiler could see that you are writing
> > at
> > the same location without proper synchronization and conclude that you are
> > not using threads and optimize away all the other locks)
> > 
> > (This is getting a bit out of topic)
> Unless there are out-of-thin-air values, I don't see how a UB could kick in
> and I don't think atomics are necessary.
> See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4323.html -
> "Out-of-Thin-Air Execution is Vacuous"

"UB could ckick in" has no meaning.

In practice there is no reason why casting a pointer to member function to 
remove the const would not work. Yet, you would not accept it[1].

Data races are undefined behavior according to the standard. So anything could 

(I mentioned that the compiler could remove locks, but it could also use the 
buffer as temporary scratch area for something else knowing that the memory is 
going to be overwritten, or it could just replace the main() function with an 
empty body, knowing that your program has undefined behavior)

[1] remember https://codereview.qt-project.org/13013/ ?


Woboq - Qt services and support - http://woboq.com - http://code.woboq.org

/me decided this thread shall live on :-)

More information about the Development mailing list