The distinction given between #define and typedef has one significant error:

 typedef does not in fact create a new type. 
        It must be emphasized that a typedef declaration does not create a new 
type in any sense; it merely adds a new name(alias) for some existing type. Nor 
are there any new semantics: variables declared this way have exactly the same 
properties as variables whose declarations are spelled out explicitly. In 
effect, typedef is like #define, except that since it is interpreted by the 
compiler, it can cope with textual substitutions that are beyond the 
capabilities of the preprocessor



----- Original Message ----
From: Jaspreet Singh <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, 15 November, 2007 5:59:29 PM
Subject: Re: [c-prog] What's the diff bet'n typedef and #define

On Nov 15, 2007 11:46 AM, mahesh w <[EMAIL PROTECTED]> wrote:
>
>
>
>
> Hi,
>
> As I think "typedef" is used for creating alias for a
> data type( user defined data type like struct or
> language supported data type). It is all concerned
> with data type.
>
> "#define" is used for replacing the defined macro with
> its body. "#define" is processed by macro
> preprocessor.
> (I don't know what processes the "typedef". macro
> preprocessor OR compiler OR something else).
> plz correct me whereever I am wrong.
>
> Can we achieve the functionality of "typedef" with
> "#define"? If yes why "typedef" is there?
>
> What are the differences?
>
> Mahesh
>
http://c-faq.com/decl/typedefvsdefine.html


To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>. 
Yahoo! Groups Links




      5, 50, 500, 5000 - Store N number of mails in your inbox.. Go to 
http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html

[Non-text portions of this message have been removed]

Reply via email to