Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Warnings in lcc-win

Reply
Thread Tools

Warnings in lcc-win

 
 
Charlie Gordon
Guest
Posts: n/a
 
      10-03-2007
"Old Wolf" <(E-Mail Removed)> a écrit dans le message de news:
(E-Mail Removed) om...
> On Oct 2, 7:34 pm, CBFalconer <(E-Mail Removed)> wrote:
>> Old Wolf wrote:
>> > CBFalconer <(E-Mail Removed)> wrote:
>> >> Old Wolf wrote:
>> >>> CBFalconer <(E-Mail Removed)> wrote:

>>
>> >>>> Now why would you say that? To my mind, prototypes have just two
>> >>>> purposes: 1. Expose the calling sequence to other files, and 2.
>> >>>> Resolve indirect recursive calls.

>>
>> >>> Surely the primary purpose is to ensure that all calls to the
>> >>> function pass the correct count and type of arguments, and receive
>> >>> the return value correctly.

>>
>> >> No, because that is handled by the declaration before use
>> >> requirement.

>>
>> > No it isn't; e.g.

>>
>> > int memset();

>>
>> > int main() {
>> > char x[4];
>> > memset(x, sizeof x, 100); /* BUG */
>> > }

>>
>> Why did you delete the example I gave?

>
> Because it was not relevant. You made an assertion, and provided
> a corroborative example. I provided a counterexample, proving
> the assertion false.
>
>> That was a proper
>> definition, with proper definition of parameters etc. And it did
>> not use the reserved std. library name. You are using an ancient
>> K&R1 declaration.

>
> That's the whole point.


memset can be abused even in presence of a proper declaration from
<string.h>

#include <string.h>
int main(void) {
char x[4];
memset(x, 4, 100); /* arguments in wrong order */
return 0;
}

Also, what I was complaining about earlier is the counterproductive effect
your post may have on newbies: many people rely on visual memory, it is
disingenious to post bogus code without properly tagging it as such.

--
Chqrlie.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with syntesis warnings JnCodesigns VHDL 2 04-30-2007 06:31 PM
there are too many warnings (you are about to....etc etc forever) after installing Firefox trevor_smithson@yahoo.com Firefox 2 10-13-2005 07:35 PM
What to do with "Unconnected output port" warnings? Herb T VHDL 1 04-04-2005 09:24 AM
use warnings; and use Warnings; give different results Ted Sung Perl Misc 1 08-30-2004 10:22 PM
disabling certain warnings in synopsys dc Tuukka Toivonen VHDL 1 05-11-2004 01:51 PM



Advertisments