N
Nitin Bhardwaj
Hello all,
I am puzzled by the term 'semantics' !
Well I know about 'syntax of a language' - as defined by its
associated grammar
Then what is this semantics?
What does the C Compiler checks during semantic analysis?
And does it produce error OR warnings when it encounters a semantic
mistake?
Somebody pointed out in reply to my previous post that the following
is a semantic error:
#include <stdio.h>
char *f();
int main(void)
{
char *p = f();
return 0;
}
char *f()
{
return "FooBar";
}
AFAIK, this is a Run-time bug..since the string literal will be popped
off the stack when f() returns, but is it a semantic error ? If yes,
how ?
Thanks..
I am puzzled by the term 'semantics' !
Well I know about 'syntax of a language' - as defined by its
associated grammar
Then what is this semantics?
What does the C Compiler checks during semantic analysis?
And does it produce error OR warnings when it encounters a semantic
mistake?
Somebody pointed out in reply to my previous post that the following
is a semantic error:
#include <stdio.h>
char *f();
int main(void)
{
char *p = f();
return 0;
}
char *f()
{
return "FooBar";
}
AFAIK, this is a Run-time bug..since the string literal will be popped
off the stack when f() returns, but is it a semantic error ? If yes,
how ?
Thanks..