Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] CODAN question for function can not be resolved AND invalid arguments!

Hola, Felipe,

About the "function cannot be resolved" problem: Please note that C allows calling undefined functions. C++ will not - you should get the warning right after renaming sample.c to sample.cpp.

About the "invalid arguments": The argument 'a' is a char which is implicitly castable to double, so the call h_function('a') is valid. If you try something not castable to double, you'd get the error. Try replacing that call with h_function("str").

Hope that helps. Thank you for the awareness :)

Best regards,
-- Tomasz Wesołowski

On Fri, Sep 3, 2010 at 1:03 AM, Figuer, Felipe A <Felipe.A.Figuer@xxxxxxxxxx> wrote:

Hi all.  First thanks for your help.

 

Do the “function can not be resolved” and the “invalid arguments”  checkers work?

 

I am trying them in a trivial project having the inclusion for both as: src/*.c

 

The code is quite trivial:

 

Sample.h contents:

 

#ifndef SAMPLE_H_

#define SAMPLE_H_

 

int h_function(double param);

void void_func();

#endif /* SAMPLE_H_ */

Sample.c contents:

 

#include <stdlib.h>

#include "Sample.h"

 

int main(void) {

      return EXIT_SUCCESS + h_function('a') + function_that_does_not();

}

int h_function(double param) {

      return 45;

}

 

void void_func() {

      return;

}

 

I was expecting a warning or something similar for the h_function call (it provides a char when a double is declared as the type parameter).

 

On the other hand as the case of referring an undeclared variable I was expecting a warning or something  like that for the not declared function call function_that_does_not.

 

Am I missing something?

 

Best regards and thanks again,

 

Felipe Antonio Martinez Figueroa.

+52 442 1030500 Ext.1249.

felipe.a.figuer@xxxxxxxxxx

Delphi Electronics & Safety

Software Development Tools & Expert Synergy User & Suggestions Committee Leader

Queretaro Technical Center.

Circuito Palma Cocotera No. 2059.

Fraccionamiento Palmares.

Queretaro, Qro. CP 76127

Mexico.

****************************************************************************************

Note:  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. 

****************************************************************************************

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top