This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help Needed!


I believe that this is already implemented in gcc, though I've never tried it. See:

http://www.unixwiz.net/techtips/gnu-c-attributes.html



Bencio Aristo wrote:
To whom it may concern,
I, together with other colleagues in a university in
the Philippines, are currently working on a study
regarding semantic checking of compilers. I would like
to ask some questions regarding the C compiler (gcc).
One semantic error we are looking at is the
inconsistent use of formats or types in printf and
scanf (the "%c", "%s", "%d", etc.)
an example of this semantic error is shown below:
void main (void){
char word[5];
printf("Please enter a word:");
scanf("%s", &word); printf("%c\n",word); }
Compilers should be able to determine whether the
format used in the scanf and printf for a variable are
the same. In this example, scanf used "%s" and in
printf, "%c" is used.This will cause error a runtime
error. This error also occurs in mixing up of other
types such as "%d", "%f" , and "%lf".
We are planning to do a study on this and how we can
implement it on an open source C compiler and see if
it would be feasible.


Which source file is responsible for the lexical and
syntax analyzing? (so that i may be able to add printf
and scanf as recognized symbols)

Thank you in advance.

________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now http://uk.messenger.yahoo.com/download/index.html




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]