On Jan 1 2007 18:51, Segher Boessenkool wrote:
>> If people want to return something from a ({ }) construct, they should do
>> it
>> explicitly, e.g.
>>
>> #define setcc(cc) ({ \
>> partial_status &= ~(SW_C0|SW_C1|SW_C2|SW_C3); \
>> partial_status |= (cc) & (SW_C0|SW_C1|SW_C2|SW_C3); \
>>
If people want to return something from a ({ }) construct, they should
do it
explicitly, e.g.
#define setcc(cc) ({ \
partial_status &= ~(SW_C0|SW_C1|SW_C2|SW_C3); \
partial_status |= (cc) & (SW_C0|SW_C1|SW_C2|SW_C3); \
partial_status; \
})
No, they generally should use
Robert P. J. Day wrote:
On Mon, 1 Jan 2007, Christoph Hellwig wrote:
On Sun, Dec 31, 2006 at 02:32:25PM -0500, Robert P. J. Day wrote:
+ (a) Enclose those statements in a do - while block:
+
+ #define macrofun(a, b, c) \
+ do {\
+
On Dec 31 2006 19:23, Randy Dunlap wrote:
>> >
>> > #define setcc(cc) ({ \
>> > partial_status &= ~(SW_C0|SW_C1|SW_C2|SW_C3); \
>> > partial_status |= (cc) & (SW_C0|SW_C1|SW_C2|SW_C3); })
>>
>> This _does_ return a value though, bad example.
>
> Where does it return a value? I don't see any
On Mon, 1 Jan 2007, Christoph Hellwig wrote:
> On Sun, Dec 31, 2006 at 02:32:25PM -0500, Robert P. J. Day wrote:
> > + (a) Enclose those statements in a do - while block:
> > +
> > + #define macrofun(a, b, c) \
> > + do {\
> > +
On Sun, Dec 31, 2006 at 02:32:25PM -0500, Robert P. J. Day wrote:
> + (a) Enclose those statements in a do - while block:
> +
> + #define macrofun(a, b, c) \
> + do {\
> + if (a == 5) \
> +
On Mon, 1 Jan 2007, Segher Boessenkool wrote:
> > > In this case, the second form
> > > should be used when the macro needs to return a value (and you can't
> > > use an inline function for whatever reason), whereas the first form
> > > should be used at all other times.
> >
> > that's a fair
On Mon, 1 Jan 2007, Segher Boessenkool wrote:
In this case, the second form
should be used when the macro needs to return a value (and you can't
use an inline function for whatever reason), whereas the first form
should be used at all other times.
that's a fair point, although
On Sun, Dec 31, 2006 at 02:32:25PM -0500, Robert P. J. Day wrote:
+ (a) Enclose those statements in a do - while block:
+
+ #define macrofun(a, b, c) \
+ do {\
+ if (a == 5) \
+
On Mon, 1 Jan 2007, Christoph Hellwig wrote:
On Sun, Dec 31, 2006 at 02:32:25PM -0500, Robert P. J. Day wrote:
+ (a) Enclose those statements in a do - while block:
+
+ #define macrofun(a, b, c) \
+ do {\
+ if (a
On Dec 31 2006 19:23, Randy Dunlap wrote:
#define setcc(cc) ({ \
partial_status = ~(SW_C0|SW_C1|SW_C2|SW_C3); \
partial_status |= (cc) (SW_C0|SW_C1|SW_C2|SW_C3); })
This _does_ return a value though, bad example.
Where does it return a value? I don't see any uses of it
in
Robert P. J. Day wrote:
On Mon, 1 Jan 2007, Christoph Hellwig wrote:
On Sun, Dec 31, 2006 at 02:32:25PM -0500, Robert P. J. Day wrote:
+ (a) Enclose those statements in a do - while block:
+
+ #define macrofun(a, b, c) \
+ do {\
+
If people want to return something from a ({ }) construct, they should
do it
explicitly, e.g.
#define setcc(cc) ({ \
partial_status = ~(SW_C0|SW_C1|SW_C2|SW_C3); \
partial_status |= (cc) (SW_C0|SW_C1|SW_C2|SW_C3); \
partial_status; \
})
No, they generally should use
On Jan 1 2007 18:51, Segher Boessenkool wrote:
If people want to return something from a ({ }) construct, they should do
it
explicitly, e.g.
#define setcc(cc) ({ \
partial_status = ~(SW_C0|SW_C1|SW_C2|SW_C3); \
partial_status |= (cc) (SW_C0|SW_C1|SW_C2|SW_C3); \
partial_status; \
})
Segher Boessenkool wrote:
#define setcc(cc) ({ \
partial_status &= ~(SW_C0|SW_C1|SW_C2|SW_C3); \
partial_status |= (cc) & (SW_C0|SW_C1|SW_C2|SW_C3); })
This _does_ return a value though, bad example.
Where does it return a value?
partial_status |=
as I expected (or suspected).
I
#define setcc(cc) ({ \
partial_status &= ~(SW_C0|SW_C1|SW_C2|SW_C3); \
partial_status |= (cc) & (SW_C0|SW_C1|SW_C2|SW_C3); })
This _does_ return a value though, bad example.
Where does it return a value?
partial_status |=
I don't see any uses of it
Ah, that's a separate thing
Segher Boessenkool wrote:
In this case, the second form
should be used when the macro needs to return a value (and you can't
use an inline function for whatever reason), whereas the first form
should be used at all other times.
that's a fair point, although it's certainly not the coding style
In this case, the second form
should be used when the macro needs to return a value (and you can't
use an inline function for whatever reason), whereas the first form
should be used at all other times.
that's a fair point, although it's certainly not the coding style
that's in play now. for
On Sun, 31 Dec 2006, Muli Ben-Yehuda wrote:
> On Sun, Dec 31, 2006 at 02:49:48PM -0500, Robert P. J. Day wrote:
>
> > there would appear to be *lots* of cases where the ({ }) notation
> > is used when nothing is being returned. i'm not sure you can be
> > that adamant about that distinction at
On Sun, 31 Dec 2006 22:09:03 +0200 Muli Ben-Yehuda wrote:
> On Sun, Dec 31, 2006 at 02:49:48PM -0500, Robert P. J. Day wrote:
>
> > there would appear to be *lots* of cases where the ({ }) notation is
> > used when nothing is being returned. i'm not sure you can be that
> > adamant about that
On Sun, Dec 31, 2006 at 02:49:48PM -0500, Robert P. J. Day wrote:
> there would appear to be *lots* of cases where the ({ }) notation is
> used when nothing is being returned. i'm not sure you can be that
> adamant about that distinction at this point.
IMHO, the main point of CodingStyle is to
On Sun, 31 Dec 2006, Muli Ben-Yehuda wrote:
> On Sun, Dec 31, 2006 at 02:32:25PM -0500, Robert P. J. Day wrote:
>
> > Generally, inline functions are preferable to macros resembling
> > functions.
>
> This should be stressed, IMHO. We have too many macros which have no
> reason to live.
>
> >
On Sun, Dec 31, 2006 at 02:32:25PM -0500, Robert P. J. Day wrote:
> Generally, inline functions are preferable to macros resembling
> functions.
This should be stressed, IMHO. We have too many macros which have no
reason to live.
> -Macros with multiple statements should be enclosed in a do -
Add an explanation for defining multi-line macros using the ({ })
notation to CodingStyle.
Signed-off-by: Robert P. J. Day <[EMAIL PROTECTED]>
---
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index 9069189..1d0ddb8 100644
--- a/Documentation/CodingStyle
+++
Add an explanation for defining multi-line macros using the ({ })
notation to CodingStyle.
Signed-off-by: Robert P. J. Day [EMAIL PROTECTED]
---
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index 9069189..1d0ddb8 100644
--- a/Documentation/CodingStyle
+++
On Sun, Dec 31, 2006 at 02:32:25PM -0500, Robert P. J. Day wrote:
Generally, inline functions are preferable to macros resembling
functions.
This should be stressed, IMHO. We have too many macros which have no
reason to live.
-Macros with multiple statements should be enclosed in a do -
On Sun, 31 Dec 2006, Muli Ben-Yehuda wrote:
On Sun, Dec 31, 2006 at 02:32:25PM -0500, Robert P. J. Day wrote:
Generally, inline functions are preferable to macros resembling
functions.
This should be stressed, IMHO. We have too many macros which have no
reason to live.
-Macros with
On Sun, Dec 31, 2006 at 02:49:48PM -0500, Robert P. J. Day wrote:
there would appear to be *lots* of cases where the ({ }) notation is
used when nothing is being returned. i'm not sure you can be that
adamant about that distinction at this point.
IMHO, the main point of CodingStyle is to
On Sun, 31 Dec 2006 22:09:03 +0200 Muli Ben-Yehuda wrote:
On Sun, Dec 31, 2006 at 02:49:48PM -0500, Robert P. J. Day wrote:
there would appear to be *lots* of cases where the ({ }) notation is
used when nothing is being returned. i'm not sure you can be that
adamant about that
On Sun, 31 Dec 2006, Muli Ben-Yehuda wrote:
On Sun, Dec 31, 2006 at 02:49:48PM -0500, Robert P. J. Day wrote:
there would appear to be *lots* of cases where the ({ }) notation
is used when nothing is being returned. i'm not sure you can be
that adamant about that distinction at this
In this case, the second form
should be used when the macro needs to return a value (and you can't
use an inline function for whatever reason), whereas the first form
should be used at all other times.
that's a fair point, although it's certainly not the coding style
that's in play now. for
Segher Boessenkool wrote:
In this case, the second form
should be used when the macro needs to return a value (and you can't
use an inline function for whatever reason), whereas the first form
should be used at all other times.
that's a fair point, although it's certainly not the coding style
#define setcc(cc) ({ \
partial_status = ~(SW_C0|SW_C1|SW_C2|SW_C3); \
partial_status |= (cc) (SW_C0|SW_C1|SW_C2|SW_C3); })
This _does_ return a value though, bad example.
Where does it return a value?
partial_status |=
I don't see any uses of it
Ah, that's a separate thing --
Segher Boessenkool wrote:
#define setcc(cc) ({ \
partial_status = ~(SW_C0|SW_C1|SW_C2|SW_C3); \
partial_status |= (cc) (SW_C0|SW_C1|SW_C2|SW_C3); })
This _does_ return a value though, bad example.
Where does it return a value?
partial_status |=
as I expected (or suspected).
I
34 matches
Mail list logo