ANSI C rules for variable declaration
Lokesh Walase
flokeshw24 at gmail.com
Fri Sep 21 14:36:10 EDT 2012
On Fri, Sep 21, 2012 at 11:27 AM, Adam Lee <adam8157 at gmail.com> wrote:
> On Fri, Sep 21, 2012 at 10:15:01AM +0530, Lokesh Walase wrote:
> > 0.I read that ANSI C rules for variable declaration says that one must
> declare
> > 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 that
> > are written in industry.
> > Do everyone *strictly* follow the ANSI C rules & declare the variables
> at the
> > beginning of the scope ?
>
> Yes, I do.
>
> > 2.Also , why are we still following that old rule ? Is it so that old
> codes of
> > 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.
>
> > 3.There must be some standard that all of us need to follow , so what
> are they
> > ?
>
> 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
More information about the Kernelnewbies
mailing list