Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: The Advantage of Macros

Reply
Thread Tools

Re: The Advantage of Macros

 
 
Mark McIntyre
Guest
Posts: n/a
 
      08-17-2007
On Thu, 16 Aug 2007 14:27:55 -0700, in comp.lang.c , Keith Thompson
<(E-Mail Removed)> wrote:

>SM Ryan <(E-Mail Removed)> writes:
>[...]
>> If you're referring to #defines, they are not full macros.

>
>How so? The C standard certainly refers to them as "macros". If
>there's some meaning to the term "full macros" that C's macros fail to
>fulfill, it's outside the scope of C.


I suspect Malcolm is thinking of macros in the sense that is used for
extensions to editors, spreadsheets etc. I must say I always find the
C terminology slightly peculiar when applied to what is essentially an
alias for a constant. That doesn't stop me referring to them as macros
mind you.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      08-17-2007
In article <(E-Mail Removed)>,
Mark McIntyre <(E-Mail Removed)> wrote:

>I suspect Malcolm is thinking of macros in the sense that is used for
>extensions to editors, spreadsheets etc. I must say I always find the
>C terminology slightly peculiar when applied to what is essentially an
>alias for a constant. That doesn't stop me referring to them as macros
>mind you.


The only thing you can say about macros in general in computer science
is that they are textual substitutions, and even that has been
stretched, for example by various lisps, which substitute expressions
rather than text as well as providing mechanisms to avoid name
capture. C's macros are nearer the bottom end.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
 
Reply With Quote
 
 
 
 
Malcolm McLean
Guest
Posts: n/a
 
      08-17-2007

"santosh" <(E-Mail Removed)> wrote in message
news:fa37be$rup$(E-Mail Removed)...
>> Unless I'm mistaken, "printf" is frequently implemented as a macro. I'm
>> no C expert, so I could well be mistaken. Anyone know anything about
>> this, or do we have to add comp.lang.c back to the header?

>
> I think you might be thinking of putc/getc etc. I don't think printf is
> commonly implemented as a macro.
>

I've seen the symbol printf redefined as a platform-specific call,
presumably to help out the linker.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

 
Reply With Quote
 
Malcolm McLean
Guest
Posts: n/a
 
      08-17-2007

"Mark McIntyre" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Thu, 16 Aug 2007 14:27:55 -0700, in comp.lang.c , Keith Thompson
> <(E-Mail Removed)> wrote:
>
>>SM Ryan <(E-Mail Removed)> writes:
>>[...]
>>> If you're referring to #defines, they are not full macros.

>>
>>How so? The C standard certainly refers to them as "macros". If
>>there's some meaning to the term "full macros" that C's macros fail to
>>fulfill, it's outside the scope of C.

>
> I suspect Malcolm is thinking of macros in the sense that is used for
> extensions to editors, spreadsheets etc. I must say I always find the
> C terminology slightly peculiar when applied to what is essentially an
> alias for a constant. That doesn't stop me referring to them as macros
> mind you.
>

I am not quoted here. I said the C macro system was underpowered, but I
didn't try to define the word.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

 
Reply With Quote
 
Mark McIntyre
Guest
Posts: n/a
 
      08-17-2007
On Fri, 17 Aug 2007 22:32:38 +0100, in comp.lang.c , "Malcolm McLean"
<(E-Mail Removed)> wrote:

>
>"Mark McIntyre" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed).. .
>> On Thu, 16 Aug 2007 14:27:55 -0700, in comp.lang.c , Keith Thompson
>> <(E-Mail Removed)> wrote:
>>
>>>SM Ryan <(E-Mail Removed)> writes:
>>>[...]
>>>> If you're referring to #defines, they are not full macros.
>>>
>>>How so? The C standard certainly refers to them as "macros". If
>>>there's some meaning to the term "full macros" that C's macros fail to
>>>fulfill, it's outside the scope of C.

>>
>> I suspect Malcolm is thinking of macros in the sense that is used for
>> extensions to editors, spreadsheets etc. I must say I always find the
>> C terminology slightly peculiar when applied to what is essentially an
>> alias for a constant. That doesn't stop me referring to them as macros
>> mind you.
>>

>I am not quoted here.


Apologies, I misread (or possibly failed to read) the attribs.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft SQL , Sybase advantage SQL,Advantage database Tommy Computer Support 1 11-29-2007 04:21 AM
Explanation of macros; Haskell macros mike420@ziplip.com Python 80 11-07-2003 02:22 AM
Re: Explanation of macros; Haskell macros Michael T. Babcock Python 0 11-03-2003 01:54 PM
Re: Explanation of macros; Haskell macros mike420@ziplip.com Python 5 11-01-2003 01:09 AM
Re: Explanation of macros; Haskell macros mike420@ziplip.com Python 1 10-07-2003 04:07 PM



Advertisments