LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-05-2006, 12:06 PM   #16
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,783

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492

My guess is some legacy code commonly suffer this missing semicolon bug, and the C compiler designers decided to ease this code compilation by accepting the error.

As I wrote earlier, if you don't like it, just use "gcc -Werror" or a similar option with other compilers.
 
Old 11-06-2006, 07:29 AM   #17
vkmgeek
Member
 
Registered: Feb 2006
Location: Ahmedabad
Distribution: rhel5
Posts: 185

Original Poster
Blog Entries: 2

Rep: Reputation: 31
Quote:
Originally Posted by ronald-be
Hello all,

Just to put things a bit clear... In C, any instruction should be terminated by a semicolon. The semicolon is not mandatory for block structures ( i.e {} and all between it). Notice also that the instructions within a block follow the normal rule again.
It is not like this...
#include <stdio.h>
void main()
{
int i;
{
int i
}
}

This code gives error at line 6... and which is expected...
 
Old 11-06-2006, 10:24 AM   #18
whk
Member
 
Registered: Jun 2005
Posts: 202

Rep: Reputation: 37
Eclipse IDE gave an error in C
main.c:6: error: expected ';' before '}' token
However, the reason for it still to be runnable is because it's a pointer character and any previous stinky old jetsam will appear.

BTW, on the whole C has always been an extremely open language. One could get away with very bad coding and errs, as a result, making it very unreadable.

Last edited by whk; 11-09-2006 at 10:20 AM.
 
Old 11-07-2006, 11:42 AM   #19
ronald-be
Member
 
Registered: Aug 2004
Location: Belgium
Distribution: debian 5.02
Posts: 73

Rep: Reputation: 15
hello all,

yes line 4 should give error. Didn't he left out an empty line?

greetings,

Ronald
 
Old 11-08-2006, 12:31 AM   #20
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,783

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
The C standard doesn't require a compiler to end with an error in such a situation, just to give a diagnostic message which gcc does.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bug reports on glibc or gcc tvburger Linux From Scratch 1 12-06-2004 12:43 AM
gcc wont install, 'failed dependencies: glibc-devel is needed by gcc-3.3.3-41' TdlSnare SUSE / openSUSE 3 11-29-2004 02:13 PM
Free86 bug or nVidia bug?? ProtoformX Linux - Software 2 05-12-2004 02:38 AM
Extremely strange bug in gcc/g++ Maidros Linux - Software 3 05-08-2004 06:28 AM
gcc bug? fab12 Programming 2 02-07-2004 07:44 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration