473,432 Members | 1,685 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,432 software developers and data experts.

warning : no new line at end of file

Hi,
when i compile my C programs (even 2 line progs) give the warning, no
new line at end of file.
What does this mean ?
-Regards,
Sameer

Dec 29 '05
55 25409
Richard Heathfield <in*****@invalid.invalid> writes:
Mark McIntyre said:
On 31 Dec 2005 11:00:20 -0800, in comp.lang.c , "tmp123"
<tm****@menta.net> wrote:
How do you explain the exit codes of "grep"?


In iambic pentameter.


Your wish is my command.

Now grep has quite a wonderful design,
And purposes untold and without number;
When searching for that quintessential line,
You know your trusty grep will never slumber,
Seeking, seeking, all throughout its sessions,
With full support for regular expressions.

But if you execute it from a shell script,
Wanting total searching automation,
You really need a way that you can decrypt
Those exit codes, a most complete translation.
Here's a guide to help you understand them,
So that you need not yet all hope abandon:

When grep yields zero, questing is completed,
And nothing sought remains to be disclosed;
But if our hero hands you one, defeated,
No answer is there to the search you posed;
And when your shell script with a two is treated,
Your files are wrong, or your argv is hosed.


Alas, your talk of grep, though it's quite pretty,
Is not on topic here in comp lang c.
And though to criticize you is a pity,
We must maintain our rules of pedantry.
Bandwidth is cheap, and yet we must be frugal.
(It could be worse; at least you don't use Google.)

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jan 1 '06 #51

Richard Heathfield wrote:
In comp.lang.c, that's a bit like asking "what colour socks do C hackers
prefer?" Yes, there is an answer, but no, you'll probably never find out
what it is, because comp.lang.c subscribers don't actually care what the
answer is. Yes, I guess I was way off :-).
The comp.unix.programmer and comp.lang.c newsgroups have good historical
reasons for being fluffy-bunny snuggly companions, but in practice C has
spread far and wide since those halcyon days of the 1973 kernel, and the
comp.lang.c group no longer thinks of C as being merely another word for
Unix. I've hacked out C code in ISPF/PDF, Notepad, vim, elvis, pico, and
a variety of Windows IDEs. I've written C using COPY CON and cat. I have
written C code using custom-written code generators - which can scarcely
count as editors at all. Here in comp.lang.c, the question is simply not
worth asking, I'm afraid.

I was just curios what C programmers prefer to use. Would it be safe,
for example, to guess that you prefer notepad to copy con on a regular
basis? :-)

But you're right, going down this path usually leads to things that
have nothing in common with C, so I hope people will disregard that
post.

Jan 1 '06 #52
On Sun, 1 Jan 2006 05:44:34 +0000 (UTC), in comp.lang.c , Richard
Heathfield <in*****@invalid.invalid> wrote:

(snip most excellent verse rendition of the return codes of grep).

Your sig seems curiously appropriate.... :-)
"Usenet is a strange place" - dmr 29/7/1999

Mark McIntyre
--

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jan 2 '06 #53
nelu said:

Richard Heathfield wrote:
In comp.lang.c, that's a bit like asking "what colour socks do C hackers
prefer?" Yes, there is an answer, but no, you'll probably never find out
what it is, because comp.lang.c subscribers don't actually care what the
answer is. Yes, I guess I was way off :-).


Having established that.....

<snip>
I was just curios what C programmers prefer to use. Would it be safe,
for example, to guess that you prefer notepad to copy con on a regular
basis? :-)


Weeeeelllll, if you must know, I prefer vim. :-)

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Jan 2 '06 #54
David Schwartz wrote:
"John Smith" <js@x-formation.com> wrote in message
news:43**********************@dread11.news.tele.dk ...
It means, surprise, surprise, that there is no new-line at the end of
your source file. Quoth the Standard: # A source file that is not empty shall end in a new-line character
So the next obvious question is to ask why it is this way?


So that you can concatenate files together without lines merging.
I personally think it's one of the most dumb restrictions ever made. Does
it change anything about how the program is compiled? No! I mean, who
cares about blank lines. It's the code which is important.


It does change things about how the program is compiled. Your assumption
is erroneous. Failure to end a file with a newline could result in
concatenating two files, causing the last symbol in one to merge with the
first symbol in the next.


Hmm, no, gcc does not mash input files together in this manner. It's
hard to imagine a valid C file that does not end with ; or }. On the
other hand, it is conceivable that a preprocessor directive not ending
in a newline, when manually concatenated with another file to form
input to the compiler, might cause an unexpected problem...

In ages past, I believe such lexical warnings helped flag media
problems such as a missing card, bad parity, truncated file, and such.
I am not certain that remains the rationale for this warning, however
-- since C is strict about nesting braces and statement termination (as
noted above), file corruption is likely to abort compilation anyway.

The other reason is simply for logical consistency. A line is defined to
end with a specific line ending character. A source file is defined to
consist of lines.
Apple also seems to have disabled this in their version of gcc on Mac OS
X.


They are not required to issue a warning.

DS


Jan 2 '06 #55

"toby" <to**@telegraphics.com.au> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
David Schwartz wrote:
So that you can concatenate files together without lines merging. It does change things about how the program is compiled. Your
assumption
is erroneous. Failure to end a file with a newline could result in
concatenating two files, causing the last symbol in one to merge with the
first symbol in the next.

Hmm, no, gcc does not mash input files together in this manner.
Who was talking about gcc?
It's
hard to imagine a valid C file that does not end with ; or }.
On the contrary, most header files end with a preprocessor directive.
On the
other hand, it is conceivable that a preprocessor directive not ending
in a newline, when manually concatenated with another file to form
input to the compiler, might cause an unexpected problem...
Exactly.
In ages past, I believe such lexical warnings helped flag media
problems such as a missing card, bad parity, truncated file, and such.
I am not certain that remains the rationale for this warning, however
-- since C is strict about nesting braces and statement termination (as
noted above), file corruption is likely to abort compilation anyway.


I think it's just for logical consistency. A text file consists of
lines. A line is defined as ending with a line terminator.

DS
Jan 2 '06 #56

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: thule | last post by:
Okay, thanks to John (THANK YOU SO MUCH). I switched all my header files over to using the new Standard <iostream> and included the using namespace std; . This seems to have fixed all the errors I...
40
by: Dave Hansen | last post by:
Please note crosspost. Often when writing code requiring function pointers, it is necessary to write functions that ignore their formal parameters. For example, a state machine function might...
3
by: Bill Burris | last post by:
How do I find what is causing this warning from the Linker? If I use /NODEFAULTLIB I get hundreds of undefined symbols. LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other...
10
by: moondaddy | last post by:
I converted a vb.1.1 web service project to 2.0 and .net 2.0 created / replace some datasets. The code it automatiacly generated gets a warning message as follows: Warning 150 Name...
19
by: lawrence k | last post by:
How can I find out where my script is outputting to the screen for the first time? My error logs are full of stuff like this: PHP Warning: session_start(): Cannot send session cache...
0
by: Manish | last post by:
PHP INI File Setting ------------------------------------------------------------------------------------------------------------------ error_reporting = E_ALL & ~E_NOTICE No warning message are...
3
by: siyaverma | last post by:
i am trying to upload csv file from user's computer to main server the code i am using is if(((isset($_GET)) && ($_GET=="yes")) ) { $typefield = $_GET; echo...
8
by: benn | last post by:
Here's the setup... Defines.h file contains: enum DAY { monday, tueday }; DayFunctions.h contains prototype: void printIsMonday ( enum DAY currentDay); DayFunctions.c contains:
9
by: awagner | last post by:
I am compiling a C application on an HP Unix 11.23 platform using the C99 compiler. I am receiving the following three warning message from the /usr/include/sys/_mbstate_t.h include file. ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.