Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 27 Aug 2013 10:52:55 +0200
From: Jens Gustedt <>
Subject: Re: Optimized C memset


Am Dienstag, den 27.08.2013, 04:30 -0400 schrieb Rich Felker:
> One aspect of this code that may appear ugly at first is the usage of
> the __GNUC__ macro.

It not only *appears* to be ugly :)

You already have a slight inconsistency in that at one point the code
depends on a particular version of "gcc" and other part only depends
on the fact that the __GNUC__ macro is set.

There are a lot of compilers out there faking to be a gcc of some
version and that are not always feature consistent with the gcc
version that they are claming to fake. ICC is notorious for that. So
to my opinion this is a dangerous path to follow. (I don't know about
any problems with the __may_alias__ attribute, though)

To make this easier to maintain, I'd suggest to introduce a special
feature test macro, something like __has_may_alias__, and have that
set at the beginning of the file in a section that is clearly
dedicated to compile time feature detection. Other compilers may have
different syntax for such a feature (a _Pragma comes in mind) and may
be detected quite differently than by gcc version numbering.

Such specific feature test macros is the way that clang goes, and from
my experience this is much easier to maintain and to understand when
you stumble on such #ifdef'ed code. You not only know that this needs
a special version of a compiler, but also for what reason.



:: INRIA Nancy Grand Est ::   ::
:: AlGorille ::::::::::::::: office Nancy : +33 383593090   ::
:: ICube :::::::::::::: office Strasbourg : +33 368854536   ::
:: ::::::::::::::::::::::::::: gsm France : +33 651400183   ::
:: :::::::::::::::::::: gsm international : +49 15737185122 ::

Download attachment "signature.asc" of type "application/pgp-signature" (199 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.