most compilers will give an error on division by zero
2006-09-04 13:17:54
·
answer #1
·
answered by Anonymous
·
0⤊
1⤋
Hi.
A compiler checks syntax, semantics, and references.
syntax - the code you wrote does not match the grammar of the particular programming language. For example, grammar says you write an expression as A + B = C but you wrote it as A plus B eq C. That would generate a syntax error.
semantics - There are implied rules or sequences that you did not following. For example, in some languages you must declare a variable before you can use it.
var myVariable; // declaring a variable
myVariable + 1 = myVariable; //using variable in an expression
If I removed 'var myVariable;', the complier would generate an error.
references - Your code might references external code or libraries. The compiler would generate an error if it is unable to locate those libraries. For example, in C/C++ you use the #include directive to include a library. But if the library cannot be found, the compiler will generate an error.
2006-08-30 23:42:29
·
answer #2
·
answered by Leon Spencer 4
·
0⤊
0⤋
A compiler usually gives an error when the process of compilation to binaries/executables encounter an error generated by the programmer(meaning Buggy codes).
There are many types of errors.The most troublesome type are those that occur at runtime(they pass the compilation), EG the screen suddenly freeze when playing a game.
2006-08-30 23:42:37
·
answer #3
·
answered by JavaClark 5
·
0⤊
0⤋
I would say syntax error is the most common compiler error class, for example most languages only allow one assignment per statement so if you have two you will get an error
eg
a <= 3
b <= a
is legal but
b <= a <= 3
might not be (naturally, depending on the language).
Another class of error would be an illegal declaration, for example declaring the same variable as two different types.
eg
int avar
...
string avar
2006-08-30 23:33:18
·
answer #4
·
answered by Graham I 6
·
0⤊
0⤋
Very vague question!
A syntax error would be thrown if a random character was in the code which the compiler wasn't expecting.
e.g. in VB.net
Private Sub PopulateLocal(ByVal dr As SafeDataReader)
ID = dr.GetInt32("ID")
code = dr.GetString("code")
name = dr.GetString("name")
;
End Sub
The compiler would give you an error because of the ;
There are many many many more reasons why it might throw an error though.
2006-08-30 23:19:50
·
answer #5
·
answered by Iain T 3
·
1⤊
0⤋
In relation to VB
There are so many examples for Compiler errors
Any line which doesnot meet the syntax will be under Compiler errors
Suppose you want to show a message in a message box
Then we should write
MsgBox("Show this message in a message box")
But if we write the above as
MsgBox("show this)
this is a syntax error Or
Msg Box(show this") is also a compiler error
so on........
2006-09-06 19:03:01
·
answer #6
·
answered by bhiravi k 3
·
0⤊
0⤋
Any number of reasons. Syntax, unresolved symbol, missing or incomplete build requirement or environment, insufficient resources, the list can go on and on and on.
However, because you're being vague, I figure this is some kind of examination question, so go with syntax error.
2006-08-30 23:25:04
·
answer #7
·
answered by Simon D 3
·
0⤊
0⤋
It depends on what the error is. There are thousands of different errors and twice as many reasons.
2006-08-30 23:24:03
·
answer #8
·
answered by John K 4
·
0⤊
0⤋
Copy one of the messages above and try to compile it...:D.
2006-09-04 08:33:29
·
answer #9
·
answered by None A 3
·
0⤊
0⤋
*sarcasm*
Yeah sure, why don't u upload your entire coursework and we'll do it for you!
2006-08-31 03:21:40
·
answer #10
·
answered by keith 3
·
0⤊
0⤋