![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Fredrik Eriksson
Subject: Re: You thought 4K graphics demos were impressive?
Date: 29 Aug 2009 14:45:06
Message: <op.uzfs1fla7bxctx@e6600>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Sat, 29 Aug 2009 20:20:56 +0200, Warp <war### [at] tag povray org> wrote:
> Darren New <dne### [at] san rr com> wrote:
>> Hence my clarification. It's obviously a valid .h file. But is it a
>> valid .c file?
>
> According to gcc, no (although it does compile it nevertheless):
>
> > touch test.c
> > ls -l
> total 0
> -rw-r--r-- 1 warp users 0 2009-08-29 21:18 test.c
> > gcc -pedantic -c test.c
> test.c:1: warning: ISO C forbids an empty source file
> warp@a8:~/tmp/hops>ls -l
> total 4
> -rw-r--r-- 1 warp users 0 2009-08-29 21:18 test.c
> -rw-r--r-- 1 warp users 684 2009-08-29 21:18 test.o
Not everyone thinks that GCC is right about this. The only relevant part I
can find in the actual standard is "A source file that is not empty shall
end in a new-line character" (5.1.1.2.2), which seems to imply that empty
source files are OK.
--
FE
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Jim Henderson
Subject: Re: You thought 4K graphics demos were impressive?
Date: 29 Aug 2009 14:46:00
Message: <4a997768$1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Sat, 29 Aug 2009 14:22:40 -0400, Warp wrote:
> Jim Henderson <nos### [at] nospam com> wrote:
>> Yes, it would be a valid .c file because a library doesn't need to have
>> a main() function.
>
> Have you checked that the C standard agrees with you?
And further, a multi-file C program doesn't require that every .c file
have a main() function defined. Therefore, having a .c file that has no
main() function in it *is* valid.
Jim
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Fredrik Eriksson
Subject: Re: You thought 4K graphics demos were impressive?
Date: 29 Aug 2009 14:50:18
Message: <op.uzfs94pq7bxctx@e6600>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Sat, 29 Aug 2009 20:43:36 +0200, Jim Henderson <nos### [at] nospam com>
wrote:
>
> Windows programs also don't include a main() function - their entry is
> WinMain() IIRC.
This of course being a platform-specific, non-standard convenience
extension.
--
FE
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Jim Henderson
Subject: Re: You thought 4K graphics demos were impressive?
Date: 29 Aug 2009 14:51:55
Message: <4a9978cb$1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Sat, 29 Aug 2009 20:50:18 +0200, Fredrik Eriksson wrote:
> On Sat, 29 Aug 2009 20:43:36 +0200, Jim Henderson <nos### [at] nospam com>
> wrote:
>>
>> Windows programs also don't include a main() function - their entry is
>> WinMain() IIRC.
>
> This of course being a platform-specific, non-standard convenience
> extension.
Yes, it's defined as a "freestanding" program IIRC. Point is that you
can specify a different entry point if desired.
Jim
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Warp
Subject: Re: You thought 4K graphics demos were impressive?
Date: 29 Aug 2009 15:28:12
Message: <4a99814c@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Jim Henderson <nos### [at] nospam com> wrote:
> On Sat, 29 Aug 2009 14:22:40 -0400, Warp wrote:
> > Jim Henderson <nos### [at] nospam com> wrote:
> >> Yes, it would be a valid .c file because a library doesn't need to have
> >> a main() function.
> >
> > Have you checked that the C standard agrees with you?
> I researched a little bit, yes. By definition, a library is not a
> program, just a collection of functions, and as such, a main function is
> not required (in fact, it could cause problems to have a library with a
> main() function).
That's not what I meant. I was talking about source files which contain
nothing. The question was whether an empty file is a valid C source file,
to which you responded positively, which is why I asked whether the standard
also says so.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Jim Henderson
Subject: Re: You thought 4K graphics demos were impressive?
Date: 29 Aug 2009 15:31:19
Message: <4a998207$1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Sat, 29 Aug 2009 15:28:12 -0400, Warp wrote:
> Jim Henderson <nos### [at] nospam com> wrote:
>> On Sat, 29 Aug 2009 14:22:40 -0400, Warp wrote:
>
>> > Jim Henderson <nos### [at] nospam com> wrote:
>> >> Yes, it would be a valid .c file because a library doesn't need to
>> >> have a main() function.
>> >
>> > Have you checked that the C standard agrees with you?
>
>> I researched a little bit, yes. By definition, a library is not a
>> program, just a collection of functions, and as such, a main function
>> is not required (in fact, it could cause problems to have a library
>> with a main() function).
>
> That's not what I meant. I was talking about source files which
> contain
> nothing. The question was whether an empty file is a valid C source
> file, to which you responded positively, which is why I asked whether
> the standard also says so.
The bit you quoted from what I said specifically had to do with a main()
function not being needed. It wasn't clear that you were talking about
an empty file, I thought you were specifically talking about the lack of
a main() function, since that's what you quoted.
Though now that you've clarified, I see that it could be read either way.
Jim
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Darren New
Subject: Re: You thought 4K graphics demos were impressive?
Date: 29 Aug 2009 20:02:11
Message: <4a99c183$1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Jim Henderson wrote:
> Though now that you've clarified, I see that it could be read either way.
I anyone else amused that one can start a flame war amongst geeks over an
empty file? :-)
--
Darren New, San Diego CA, USA (PST)
Understanding the structure of the universe
via religion is like understanding the
structure of computers via Tron.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Jim Henderson
Subject: Re: You thought 4K graphics demos were impressive?
Date: 29 Aug 2009 22:33:16
Message: <4a99e4ec$1@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Sat, 29 Aug 2009 17:02:10 -0700, Darren New wrote:
> Jim Henderson wrote:
>> Though now that you've clarified, I see that it could be read either
>> way.
>
> I anyone else amused that one can start a flame war amongst geeks over
> an empty file? :-)
Oh, yes, I am very amused by this. :-)
Jim
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Nicolas Alvarez
Subject: Re: You thought 4K graphics demos were impressive?
Date: 29 Aug 2009 23:48:07
Message: <4a99f677@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Warp wrote:
> triple_r <nomail@nomail> wrote:
>> cp smr.c smr
>> chmod +x smr
>
> I thought it was supposed to be the Internet Obfuscated *C* Code
> Contest.
>
> That's not C.
They give awards for "best abuse of the rules" in that contest too.
That may not be C, but it *technically* followed the rules (and made the
organizers fix the rules for the next round).
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
From: Warp
Subject: Re: You thought 4K graphics demos were impressive?
Date: 30 Aug 2009 02:51:03
Message: <4a9a2157@news.povray.org>
|
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Darren New <dne### [at] san rr com> wrote:
> Jim Henderson wrote:
> > Though now that you've clarified, I see that it could be read either way.
> I anyone else amused that one can start a flame war amongst geeks over an
> empty file? :-)
Where is it?
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |