SSVAL()

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue Apr 20 20:12:17 MDT 2010


On Wed, Apr 21, 2010 at 08:10:42AM +1000, tridge at samba.org wrote:
>  > Given a recent bug I had to fix because I was not aware
>  > SSVAL is a macro (I used val++ in the argument), I have to
>  > agree with Jeremy that macros should be as ugly to read as
>  > possible.
> 
> I just noticed that SSVAL only uses its arguments twice on some
> platforms (it depends if CAREFUL_ALIGNMENT is set). That is a
> potential trap as testing will only catch this on some systems.

That's exactly what caught me. I think I had a customer bug
on SPARC that I could not reproduce on my i386 laptop.

> I wonder what the performance penalty would be if we instead declared
> a local variable inside the macro (using do {} while (0)} and thus
> didn't reuse the argument?

Very likely none with a decent compiler.

Volker


More information about the samba-technical mailing list