[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: [Calligra] 15809b3: also add limited support for the new
From:       Marijn Kruisselbrink <m.kruisselbrink () student ! tue ! nl>
Date:       2010-12-16 7:52:10
Message-ID: 201012152352.11355.m.kruisselbrink () student ! tue ! nl
[Download RAW message or body]

On Wednesday, December 15, 2010 12:40:39 pm Inge Wallin wrote:
> On Saturday, December 11, 2010 15:54:50 Marijn Kruisselbrink wrote:
> > +static inline quint64 readU64(const void* p)
> > +{
> > +    return quint64(readU32(p)) | quint64(readU32(reinterpret_cast<const
> > char*>(p)+4)) << 32; +}
> > +
> 
> This code is very dangerous since it is specified that the order between
> the evaluations of the terms is undefined. Better make the calls to the
> readU32 serial explicitly.
> 
> I know this because I wrote something similar myself at one point and
> caused a bug that was apparently very difficult to find. (I didn't work at
> that place any more then.)
Well, the order of evaluation of these two readU32 calls doesn't matter, as 
they are pure functions (i.e. have no side effects).

Marijn

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic