Re: ANSI C rules for variable declaration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Fri, Sep 21, 2012 at 11:27 AM, Adam Lee <adam8157@xxxxxxxxx> 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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux