User forums > Using Code::Blocks
C::B compiles in K&R C and not ANSI C...?
rcoll:
By default the GCC C-compiler operates in "C99" mode, which does require a cast of one pointer type to another (in this case a "void *" to a "char *"). C99 is neither K&R nor ANSI, but has elements of both.
However, at this point we are no longer talking about C::B, but the multitude of C standards out there. You could get better help by asking the guys on USENET on the "comp.lang.c" list.
Ringo
LiK:
r u sure about this?
Anyway.. Even so the problem still remains..
Not solved even when i put the -ansi flag at the compiler options.
So i still think it has something to do with C::B. I hadn't that problem with DevC++ or Pelles C.
Thanks
rcoll:
Actually, I copied your original code into a brand new C::B "console" project, and it compiled and ran just fine. No problems at all. Apparentely the GCC optimizer is smart enough to translate a "void *" into a "char *" with no problems.
Are you sure you are compiling a "C" project, and not a "C++" project? Is your main program named "main.c" or "main.cpp" ?
Ringo
LiK:
(!) (!)
Yes i am.. I posted that only this small part for illustration reasons.
the whole program is much bigger with not other errors.. Just 2 errors of this kind..
What is more i reinstalled C::B and same happened.. :(
any ideas?
thx 4 helping :)
rcoll:
When I create a default C-language project, the only compiler options I have checked is optimization "O2", and your code snippet compiled good.
What options do you have checked? Also, what version of GCC are you using? My system is using GCC 3.4.4
Ringo
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version