Re: K&R2 section 2.7 type conversions (exercise)



arnuld wrote:
this is exercise 2-3 from the mentioned section. i have created a
solution for it but i see errors and i tried to correct them but still
they are there and mostly are out of my head:

<snip>

Well, fix the errors and warnings gcc is reporting. You're making
several fundamental mistakes. You've not yet understood how to pass
arrays to functions, how to match prototype with function definition,
declaring objects before trying to use them and scope of various types
of objects.

I suspect that you're skipping ahead in K&R without fully
understanding the previous material. This group cannot repeatedly
correct the same errors you make. You'll have to demonstrate that
you're able to learn and desist from previous mistakes.

To start with correct, or try to correct, all the errors, (not
warnings), that gcc is complaining about. Start from the errors
mentioned first and after each correction, recompile and note the new
diagnostic messages. Do this till all the errors are removed. Then we
can progress to constructs that generate a warning.

Always use the -pedantic option with -std=XX, otherwise gcc may accept
implementation specific extensions.

.



Relevant Pages

  • Re: 2.6.5-rc1-tiny1 for small systems
    ... > This is the latest release of the -tiny kernel tree. ... looks like my gcc does not like ... Now, actual warnings for eisa-bus.c, followed by .config ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: how to cast from (void*) to other types?
    ... warnings using gcc, I get no warnings. ... If not you are either not doing what you say or you are using a broken version of gcc. ... The reason I know that all working version of gcc produce a warning or error for the code you've described is that integer types, such as int, are not assignment compatible with pointers of any type, so for a compiler to conform to the standard it is *required* to produce a diagnostic and the code is *not* required to work even if you add in a cast to shut the compiler up. ...
    (comp.lang.c)
  • Re: howto get rid of pointer arguments differ in signedness
    ... Since the code Over the past decade or so, gcc ... Why is this warning different from any of the other warnings that gcc ... modify the compiler settings such that it is never displayed anymore. ... to fix it. ...
    (comp.os.linux.development.apps)
  • Re: POSIX_C_SOURCE
    ... > is defined to have a value of zero, and GCC ... Many gcc options generate warnings with legal C source and this is ... The problem is one of incompatibility between the header files and the ... compiler options selected. ...
    (freebsd-stable)
  • Re: Code Standard 2.0 new objects outside of Try Block
    ... Just assign null to the variables - this should stop those warnings. ... I have been declaring objects before a try block in case I would ever ... object with a connection string with an incorrect syntax it will throw ... an InvalidArgument exception. ...
    (microsoft.public.dotnet.general)