Hello Sebastian,<br><br>> Two problems:<br>
> 1. You use sometimes use not a real blank (0x20) but a chracter that<br>
> looks like a blank (0xa0).<br>
><br>
> 2. In C it is not allowed to definie functions inside other<br>> functions. I did not even know gcc accepts this.<br>><br><br><br>1. I am not sure about this character '0xa0', I used vim editor for this, I am not sure how come such characters come in a standard vim editor, I will check with this problem. <br>
I think dos2unix utility should be able to convert this kind of issue, if all it is there.<br><br>2. I use gcc my o/p for gcc -v is <br><br>[root@localhost vijay]# gcc -v<br>Using built-in specs.<br>Target: i386-redhat-linux<br>
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-cpu=generic --host=i386-redhat-linux<br>
Thread model: posix<br>gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)<br><br>I also tried with another version of gcc on my other system with gcc version <br><br>[root@suman_linux vijay]# gcc -v<br>Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.6/specs<br>
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux<br>
Thread model: posix<br>gcc version 3.4.6 20060404 (Red Hat 3.4.6-8)<br><br>This also compiles the code perfectly fine with <br><br>gcc -o my my.c -O -Wall<br><br>Many of open source C projects have been using this functionality example glibc...., Also it may be used where we need to call common functions with different definition.<br>
Please, have a look at this part of code<br><br>#include <stdio.h><br>static void Call(int *a)<br>{<br> int StatusUpdate;<br> int MyOne()<br> {<br> return 1;<br> }<br> if (a==NULL) return;<br> if (*a == 1 )<br> StatusUpdate = MyOne();<br>
else<br> StatusUpdate = (*a);<br>}<br><br>int main()<br>{<br> int call; /* call is not initialized */<br> int MyOne()<br> {<br> return 2;<br> }<br> Call( &call);<br> MyOne();<br> return 0;<br>}<br><br>Again this gives me a error with splint <br>
<br>[root@suman_linux vijay]# splint 1.c<br>Splint 3.1.1 --- 15 Jun 2004<br><br>1.c:6:3: Parse Error. (For help on parse errors, see splint -help parseerrors.)<br>*** Cannot continue.<br><br>Sincere Regards<br>Vijayendra Suman <br>
<br><br><div class="gmail_quote">On Tue, May 12, 2009 at 5:28 PM, Sebastian Waschik <span dir="ltr"><<a href="mailto:sebastian.waschik@gmx.de">sebastian.waschik@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
<div class="im"><br>
Vijayendra Suman <<a href="mailto:vijayendra.suman@gmail.com">vijayendra.suman@gmail.com</a>> writes:<br>
> Hello All,<br>
> Thanks for the prompt response,<br>
> Here is the small piece of code this is compilable<br>
> 1 #include <stdio.h><br>
> 2 void Call(int *a)<br>
> 3 {<br>
> 4 int StatusUpdate;<br>
> 5 int MyOne()<br>
> 6 {<br>
<br>
</div>Two problems:<br>
1. You use sometimes use not a real blank (0x20) but a chracter that<br>
looks like a blank (0xa0).<br>
<br>
2. In C it is not allowed to definie functions inside other<br>
functions. I did not even know gcc accepts this.<br>
<br>
<br>
With cleanup a get the following messages. Source code follows.<br>
<br>
Greetings from Hamburg<br>
Sebastian Waschik<br>
<br>
<br>
Splint 3.1.1 --- 21 Apr 2006<br>
<br>
test.c: (in function main)<br>
test.c:26:8: Passed storage &call not completely defined: Call (&call)<br>
<div class="im"> Storage derivable from a parameter, return value or global is not defined.<br>
Use /*@out@*/ to denote passed or returned storage which need not be defined.<br>
(Use -compdef to inhibit warning)<br>
</div>test.c:23:14: Parameter argc not used<br>
A function parameter is not used in the body of the function. If the argument<br>
is needed for type compatibility or future plans, use /*@unused@*/ in the<br>
argument declaration. (Use -paramuse to inhibit warning)<br>
test.c:23:27: Parameter argv not used<br>
test.c:2:5: Variable exported but not used outside test: StatusUpdate<br>
A declaration is exported, but not used outside this module. Declaration can<br>
use static qualifier. (Use -exportlocal to inhibit warning)<br>
test.c:3:5: Function exported but not used outside test: MyOne<br>
test.c:7:1: Definition of MyOne<br>
test.c:8:5: Function exported but not used outside test: MyTwo<br>
test.c:12:1: Definition of MyTwo<br>
test.c:14:6: Function exported but not used outside test: Call<br>
test.c:21:1: Definition of Call<br>
<br>
<br>
#include <stdio.h><br>
int StatusUpdate;<br>
int MyOne()<br>
<div class="im">{<br>
printf("One \n");<br>
return 1;<br>
}<br>
</div>int MyTwo()<br>
{<br>
printf("Two \n");<br>
return 2;<br>
}<br>
<br>
void Call(int *a)<br>
<div class="im">{<br>
if (a==NULL) return;<br>
if (*a == 1 )<br>
StatusUpdate = MyOne();<br>
else<br>
StatusUpdate = MyTwo();<br>
}<br>
<br>
</div><div class="im">int main(int argc, char * argv[])<br>
</div>{<br>
<div class="im"> int call; /* call is not initialized */<br>
</div> Call(&call);<br>
return 0;<br>
<div><div></div><div class="h5">}<br>
<br>
_______________________________________________<br>
splint-discuss mailing list<br>
<a href="mailto:splint-discuss@mail.cs.virginia.edu">splint-discuss@mail.cs.virginia.edu</a><br>
<a href="http://www.cs.virginia.edu/mailman/listinfo/splint-discuss" target="_blank">http://www.cs.virginia.edu/mailman/listinfo/splint-discuss</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><a href="https://mail.google.com/mail/?ui=2&view=bsp&ver=1qygpcgurkovy">https://mail.google.com/mail/?ui=2&view=bsp&ver=1qygpcgurkovy</a><br>Regards <br>
Vijayendra Suman<br>