Re: Compiles without Executing
- From: Dave <solomons_dad.w.marks_and_whom@xxxxxxxxxx>
- Date: Wed, 01 Mar 2006 09:53:01 +0000
CNerd2025 wrote:
My boss, sort of an eccentric guy, came in today and asked if I could
write a program that:
a) compiles correctly
b) is logically correct, and
c) never executes.
I immediately told him a seg fault, but he said, "it is entirely
correct". He also mentioned that some guy at (he believes)
Rutherford-Appleton Laboratory has solved it with some 4-line program.
Anyone know what's up with it? Thanks.
--Drew
Was it a test of your knowledge, or has he written a program that crashes before entering main and he's trying to figure out how to debug it?
Personally I'm inclined to answer "no" to the question; if it compiles and is correct, then it will run. If a program is designed to segfault and segfaults, then it is running correctly thus contradicting c. Or I'd skip the daft question and go straight to "why?" and probe for the above possibility.
I doubt someone in RAL has "solved" it with a 4-liner. If it gets past the first line then it is executing and thus contradicts c. If it doesn't get past the first line then he could solve it with a one liner that is a copy of the four liner without the extra three lines; in fact you could "solve" it with any length program; if it doesn't get past the first line then what comes after that is completely irrelevant.
Dave.
.
- Follow-Ups:
- Re: Compiles without Executing
- From: niklasb
- Re: Compiles without Executing
- Prev by Date: Re: Anyone interested in being paid to find a solution to a commercial problem?
- Next by Date: Re: porting c program from linux to windows
- Previous by thread: Re: Compiles without Executing
- Next by thread: Re: Compiles without Executing
- Index(es):