On 06/18/2014 09:24 AM, Jakub Jelinek wrote:
You're returning a T *, not a void *, and C++ requires that pointers are
properly aligned even if they aren't dereferenced.
C qsort doesn't return anything and the comparison function returns int.
extern void qsort (void *__base, size_t __nmemb, si
On Wed, Jun 18, 2014 at 09:18:10AM +0200, Florian Weimer wrote:
> On 06/17/2014 05:00 PM, Jakub Jelinek wrote:
>
> >>>GCC will likely not optimize it away at this point, but having code with
> >>>undefined behavior is just asking for future trouble. Just use "" instead?
> >>
> >>It's always const
On 06/17/2014 05:00 PM, Jakub Jelinek wrote:
GCC will likely not optimize it away at this point, but having code with
undefined behavior is just asking for future trouble. Just use "" instead?
It's always const and may lack sufficient alignment. The former isn't a
problem in C++ (I think), b
On Tue, Jun 17, 2014 at 04:52:29PM +0200, Florian Weimer wrote:
> On 06/17/2014 04:39 PM, Jakub Jelinek wrote:
> >On Tue, Jun 17, 2014 at 04:34:16PM +0200, Florian Weimer wrote:
> >>>I'm not that familiar with the exact requirements of std::vector, could
> >>>we use the same trick as
> >>>http://mx
On 06/17/2014 04:39 PM, Jakub Jelinek wrote:
On Tue, Jun 17, 2014 at 04:34:16PM +0200, Florian Weimer wrote:
I'm not that familiar with the exact requirements of std::vector, could
we use the same trick as
http://mxr.mozilla.org/mozilla-central/source/xpcom/glue/nsTArray.h#275
that is instead of
On Tue, Jun 17, 2014 at 04:34:16PM +0200, Florian Weimer wrote:
> >I'm not that familiar with the exact requirements of std::vector, could
> >we use the same trick as
> >http://mxr.mozilla.org/mozilla-central/source/xpcom/glue/nsTArray.h#275
> >that is instead of pointing at null point at a global
On 06/17/2014 04:24 PM, Trevor Saunders wrote:
On Tue, Jun 17, 2014 at 02:41:38PM +0200, Florian Weimer wrote:
On 06/12/2014 12:04 PM, Jonathan Wakely wrote:
What can we do about it?
How common is it to use std::vector with qsort, rather than
std::sort(vec.begin(), vec.end()), which does t
On Tue, Jun 17, 2014 at 02:41:38PM +0200, Florian Weimer wrote:
> On 06/12/2014 12:04 PM, Jonathan Wakely wrote:
>
> >> What can we do about it?
> >
> >How common is it to use std::vector with qsort, rather than
> >std::sort(vec.begin(), vec.end()), which does the right thing?
>
> Our very own v
On 06/12/2014 12:04 PM, Jonathan Wakely wrote:
What can we do about it?
How common is it to use std::vector with qsort, rather than
std::sort(vec.begin(), vec.end()), which does the right thing?
Our very own vec::qsort has the same problem, so I'd wager that it's
fairly common.
We coul
On 12 June 2014 10:40, Florian Weimer wrote:
> In GCC 4.9, we have optimizations that make use of non-null annotations, at
> least for removing null pointer checks. Some libc functions are annotated
> with it, such as qsort, memcpy, memset, memcmp.
Yep, as described at https://gcc.gnu.org/gcc-4.9
10 matches
Mail list logo