When I tried to use a for(int i=0;i<2000;i++) in my kernel, it says for-loop initial declaration is only allowed in C99 mode.
Should I use C99 mode for kernel development?
C99 mode
C99 mode
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Re: C99 mode
I just stick with the default and don't declare variables in the loop initialiser. No big deal.
Re: C99 mode
I'm using c99 switch, not because of for-loop initialization but just stick to a "recent" and stable standard (compare to c90).
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: C99 mode
Why would you recmmend using a version of the C language that is 24 years old, as if C wasn't a bad language already? If you really must use it, you should be rely on its most recent version (i.e., C11, although note that most compilers don't fully implement it yet). Languages, just like software, evolve for two reasons: (a) bugs, and (b) their requirements change (which is an obvious thing to happen as new technology, methodologies, and techniques develop or old ones improve). The only reason to use C89 is to compile old, C89 code.
As to why C89 is the default mode of GCC, which is probably the compiler you are using, it's so that it won't break compatibility with old build systems which expect C89 because that's the only thing that existed back when the projects they are part of were written... After all, you can't break forwards compatibility.
As to why C89 is the default mode of GCC, which is probably the compiler you are using, it's so that it won't break compatibility with old build systems which expect C89 because that's the only thing that existed back when the projects they are part of were written... After all, you can't break forwards compatibility.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: C99 mode
Ok thats what I'll do.bluemoon wrote:I'm using c99 switch, not because of for-loop initialization but just stick to a "recent" and stable standard (compare to c90).
Thanks.
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."