autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: AC_CHECK_ALIGNOF maximum ??


From: 'Chris Hall'
Subject: RE: AC_CHECK_ALIGNOF maximum ??
Date: Thu, 20 Jun 2013 16:12:51 +0100

Bob Friesenhahn wrote (on Thu 20-Jun-2013 at 15:19 +0100):
> On Thu, 20 Jun 2013, 'Chris Hall' wrote:
...
> >  AC_CHECK_ALIGNOF (type, [includes = ?AC_INCLUDES_DEFAULT?])
> >
> > which is quite lovely, as far as it goes... but it does not appear
> > to tell me the maximum possible alignment.
> >
> > Of course gcc gives __BIGGEST_ALIGNMENT__ for this.  And I guess
> > other compilers do something similar...
> >
> > ...but I cannot help feeling that autoconf should cover this, but
> > if it does, I have failed to find where :-(

> How would Autoconf portably test for this

I have no idea.  Correct me if I am wrong: but I thought Autoconf was
there to save humble journeymen like me from having to know that sort
of thing ?

> and for what purpose would you use this information for?

Specifically... I want to allocate lumps of memory with some red tape
in front to be followed by the "body" of the allocation.  That body
needs to be aligned, as if by malloc, to the maximum alignment.

For completeness, given the sizeof() the body I wish to align to
sizeof() % maximum alignment.

With C11 I could use the alignof() spell to do something more precise.
And I guess I could Autoconf my way to discovering if __alignof__() or
equivalent whizzy-ness is available.

You know and I know that 16 is probably an excellent guess that will
be true for the foreseeable... but that's hardly satisfactory !

> Compile-time estimation of biggest alignment seems risky to me if it
> is used for any serious purpose.  If all of the software in the
> running application was not compiled with the same flags, then the
> compiled-in value may be wrong.

AFAICS any disagreement about any alignment is a recipe for tears
(before, after and during bedtime).  Why should the maximum alignment
be any different ?

Thanks,

Chris




reply via email to

[Prev in Thread] Current Thread [Next in Thread]