Form feed character in header files

G

Guest

Hi,

On Cygwin, most of the header files for gcc and g++ used UNIX style
line breaks, so I've been replacing these (by copying into Wordpad
from Notepad and then copying out again) with Windows-style line
breaks. However, this doesn't get rid of instances of character 12
(Form Feed).

Is there any reason why it wouldn't be safe to delete these and thus
improve the readability of the files? Does the compiler just ignore
them?

Thanks,

James McLaughlin.
 
R

Richard Bos

On Cygwin, most of the header files for gcc and g++ used UNIX style
line breaks, so I've been replacing these (by copying into Wordpad
from Notepad and then copying out again) with Windows-style line
breaks. However, this doesn't get rid of instances of character 12
(Form Feed).

Is there any reason why it wouldn't be safe to delete these and thus
improve the readability of the files? Does the compiler just ignore
them?

We can't tell, since it depends on the compiler. The C Standard doesn't
say anything about the layout of the system header files; in fact, it
doesn't even mandate that the system headers must be files. All it
requires is that the system headers are available for use with #include,
and that they declare such-and-such functions, types and macros. _How_
they do so is up to the implementation.

You might have more luck in a Cygwin group. This is an issue where I
could even imagine Cygwin to behave differently from normal gcc.

Richard
 
B

Ben Pfaff

(e-mail address removed) writes:

[...form feeds...]
Is there any reason why it wouldn't be safe to delete these and thus
improve the readability of the files? Does the compiler just ignore
them?

A form feed is a form of white space. Compilers normally ignore
them (except inside quoted strings). The standard does not
require this behavior, but it is the most common behavior in my
experience. (It is certainly what GCC does, for what it's
worth.)
 
G

Gordon Burditt

On Cygwin, most of the header files for gcc and g++ used UNIX style
line breaks, so I've been replacing these (by copying into Wordpad
from Notepad and then copying out again) with Windows-style line
breaks. However, this doesn't get rid of instances of character 12
(Form Feed).

Is there any reason why it wouldn't be safe to delete these and thus
improve the readability of the files? Does the compiler just ignore
them?

In ordinary C source, a formfeed is white space. Except in a few
places (such as within single or double quotes), you can replace
one with a space with no change in meaning. If they are already
in a sequence of white space (e.g. before or after a newline), you
can delete them.

System headers can be special. They need not exist as files, and
if they exist as files they might be in some wierd precompiled
binary format. If they look like ordinary C headers, chances are
you can edit them, but don't blame me if something breaks.

Gordon L. Burditt
 
C

Chris Croughton

On Cygwin, most of the header files for gcc and g++ used UNIX style
line breaks, so I've been replacing these (by copying into Wordpad
from Notepad and then copying out again) with Windows-style line
breaks. However, this doesn't get rid of instances of character 12
(Form Feed).

(a) Why are you messing about with compiler standard header files? Are
you trying to break things? A number of compilers object if they get
CR characters in source.

(b) Next time you upgrade Cygwin you may get new copies of the header
files, thus undoing your work. If you use the old versions after the
upgrade then things may fail to work.

(c) There is a perfectly good utility unix2dos in Cygwin.
Is there any reason why it wouldn't be safe to delete these and thus
improve the readability of the files? Does the compiler just ignore
them?

The form feed character (in ASCII value 12, 014, 0x0C) is defined in the
standard as being one of the "white space" characters, and is thus
treated in the same way as space, tab, newline, etc.

Chris C
 
D

Default User

Hi,

On Cygwin, most of the header files for gcc and g++ used UNIX style
line breaks, so I've been replacing these (by copying into Wordpad
from Notepad and then copying out again) with Windows-style line
breaks. However, this doesn't get rid of instances of character 12
(Form Feed).


Why? If the headers are working DON'T TOUCH THEM! Those aren't yours to
edit, they belong to the implementation.




Brian
 
M

Mark McIntyre

On Tue, 09 Aug 2005 12:18:56 +0100, in comp.lang.c ,
Hi,

On Cygwin, most of the header files for gcc and g++ used UNIX style
line breaks, so I've been replacing these

Why? Cygwin doesn't care, and any decent editor will transmogrify them
visually when needed.
 
G

Guest

Thanks for the help, all. In answer to the questions about why I'm
doing this, well in/out of Wordpad is more convenient than unix2dos,
and also the UNIX line breaks make the headers unreadable in Notepad.

James.
 
K

Keith Thompson

Thanks for the help, all. In answer to the questions about why I'm
doing this, well in/out of Wordpad is more convenient than unix2dos,
and also the UNIX line breaks make the headers unreadable in Notepad.

<OT>
Then don't use Notepad. They aren't Windows-format text files, and
they aren't supposed to be. Would you use Notepad to read a DLL?

Wordpad happens to work, as do a number of other text editors that
run under Windows.

I don't even know whether the header files will continue to work after
you've modified them.
</OT>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,169
Messages
2,570,918
Members
47,458
Latest member
Chris#

Latest Threads

Top