[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Setter Gettor method style
From: |
Alexander Malmberg |
Subject: |
Re: Setter Gettor method style |
Date: |
Sun, 04 Aug 2002 17:01:13 +0200 |
[snip]
> -- All the Macros I read there are designed in a way like this:
> #define DESTROY(object) ({ \
> [...]
> })
>
> Now I am not totally sure about this, but I've learnt (listening to
> some kernel developers) that one should always write multi line
> Macros in some slightly different way like this:
>
> #define DESTROY(object) do { \
> if (object) \
> [...]
> } while(0)
>
> (http://www.rtems.com/rtems/maillistArchives/rtems-users/2001/august/msg00056.html)
>
> I see that both work, so is there one that has some advantages? Or is
> it just personal preference what to use?
The '({' stuff is a gcc extension; 'do {...} while(0)' is portable.
- Alexander Malmberg
- ANNOUNCE: netclasses 0.96, Andy Ruder, 2002/08/03
- Setter Gettor method style, Martin Häcker, 2002/08/03
- Re: Setter Gettor method style, Pascal Bourguignon, 2002/08/03
- Re: Setter Gettor method style, Martin Häcker, 2002/08/03
- Re: Setter Gettor method style, Alexander Malmberg, 2002/08/03
- Re: Setter Gettor method style, Pascal Bourguignon, 2002/08/03
- Re: Setter Gettor method style, Martin Häcker, 2002/08/04
- Re: Setter Gettor method style,
Alexander Malmberg <=
- Re: Setter Gettor method style, Martin Häcker, 2002/08/04
- Re: Setter Gettor method style, Pascal Bourguignon, 2002/08/04
- Re: Setter Gettor method style, Martin Häcker, 2002/08/05
- Message not available
- Re: Setter Gettor method style, Pascal Bourguignon, 2002/08/04
- Re: Setter Gettor method style, Martin Häcker, 2002/08/04
- Re: Setter Gettor method style, Pascal Bourguignon, 2002/08/04
- Re: Setter Gettor method style, Alexander Malmberg, 2002/08/04
- Re: Setter Gettor method style, Pascal Bourguignon, 2002/08/04
- Re: Setter Gettor method style, Alexander Malmberg, 2002/08/04
- Re: Setter Gettor method style, Pascal Bourguignon, 2002/08/04