ANSI C rules for variable declaration
From: Lokesh Walase <hidden>
Date: 2012-09-21 18:36:10
On Fri, Sep 21, 2012 at 11:27 AM, Adam Lee [off-list ref] wrote:
On Fri, Sep 21, 2012 at 10:15:01AM +0530, Lokesh Walase wrote:quoted
0.I read that ANSI C rules for variable declaration says that one mustdeclarequoted
the variables at the beginning of any scope block. C99 onwards we are allowed to declare variables as & how required. 1.NOW, my doubt is what happens in the actual "practical/real-world"codes thatquoted
are written in industry. Do everyone *strictly* follow the ANSI C rules & declare the variablesat thequoted
beginning of the scope ?Yes, I do.quoted
2.Also , why are we still following that old rule ? Is it so that oldcodes ofquoted
70s can be used with new codes ?Because I like it. And I think it's better sometimes, for example, variable declaration you mentioned, it's eaiser to trace all variables by following the ANSI C standard. ANSI C codes can be used with any modern compiler. And you can mix it with other newer standards.quoted
3.There must be some standard that all of us need to follow , so whatare theyquoted
?May be the standards followed by most people are gnu89(ANSI C with GCC extensions) and C99.
Thanks for the reply Adam !
PS, this is kind of out of topic in a kernel mail-list.
Yeah , even I was sort of confused whether to aks this here or not. Will take next time onwards :)
-- Regards, Adam Lee http://adam8157.info
-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120922/3f326361/attachment.html