Re: #define and (brackets)
- From: Tommy <bad@xxxxxxxxxxxxx>
- Date: Tue, 25 Nov 2008 15:23:59 -0500
Gerry Hickman wrote:
David Webber wrote:
I see I have started a long argument in this thread.
But it's interesting to learn about tokens, white space and macros and how they can lead to subtle bugs. I thought #define was easy until now!
They are easy. Use it wrong, like anything else, undefined behaviors
can happen.
#define FILE_READ_EA ( 0x0008 ) // file & directory
#define FILE_WRITE_EA ( 0x0010 ) // file & directory
#define FILE_EXECUTE ( 0x0020 ) // file
#define FILE_TRAVERSE ( 0x0020 ) // directory
#define FILE_DELETE_CHILD ( 0x0040 ) // directory
and I see they put some whitespace between the brackets and the number here.
Right. In this case, the white space is for clarity, the parentheses
or curved brackets are for token delimiters.
Some note:
() Parentheses or round or curved brackets
[] Brackets or squared brackets
<> Angle brackets
{} Curly Brackets or braces
---
.
- References:
- #define and (brackets)
- From: Gerry Hickman
- Re: #define and (brackets)
- From: David Webber
- Re: #define and (brackets)
- From: Gerry Hickman
- Re: #define and (brackets)
- From: David Webber
- Re: #define and (brackets)
- From: Gerry Hickman
- #define and (brackets)
- Prev by Date: Re: Who gets higher salary a Java Programmer or a C++ Programmer?
- Next by Date: Re: Simple question on Pointers
- Previous by thread: Re: #define and (brackets)
- Next by thread: Re: #define and (brackets)
- Index(es):
Relevant Pages
|