Just curiosity about some constructs
- From: Sensei <senseiwa@xxxxxxx>
- Date: Tue, 31 Jan 2006 16:01:34 +0100
Hi again!
I have still curiosity about the reason of some C constructs/keywords...
The first is about static functions. What was the reason of restricting a function to be visible just in a specific source file? Wasn't it sufficient not to be given a prototype (for visibility)?
What about register and volatile variables? Was at that time a compiler not smart enough to optimize with in-register variables? And why would someone suggest the compiler not to optimze by making a variable volatile?
Last question! This is about the switch statement. The statement seems to me to be completely different from others. Let me explain with an example. A while(condition) will execute the statement after the while(), and if someone wants to have more instructions to be executed in the loop, then { } should be used. This is true also for if/else, do/loop, but not with the switch. A case does not require any { } to execute more than one instruction, moreover, a brake must be given to make a single case being executed, otherwise all the following non-brake case statements will be executed. Why wasn't the switch like the others with { } and automatic brake?
It's probably useless, but not for curiosity...
-- Sensei <senseiwa@xxxxxxx>
Part of the inhumanity of the computer is that, once it is competently programmed and working smoothly, it is completely honest. (Isaac Asimov)
.
- Follow-Ups:
- Re: Just curiosity about some constructs
- From: Gordon Burditt
- Re: Just curiosity about some constructs
- From: Vladimir S. Oka
- Re: Just curiosity about some constructs
- From: Eric Sosman
- Re: Just curiosity about some constructs
- Prev by Date: Re: Question about the clc string lib
- Next by Date: Re: Question about the clc string lib
- Previous by thread: hi
- Next by thread: Re: Just curiosity about some constructs
- Index(es):
Relevant Pages
|