D as a betterC a game changer ?

Dan Partelly i at i.com
Mon Dec 25 09:25:46 UTC 2017


On Sunday, 24 December 2017 at 22:33:38 UTC, Walter Bright wrote:

>>Most of Phobos is actually workable with betterC, it's just 
>>that nobody had gone through >>and figured out what is.

Could you "fix" Phobos so it works out of the box regardless with 
no GC runtime ? Or at least properly label the each thing 
whatever it works in "betterC' or not ?

>
>> 3. No exceptions. (Blessing or curse ?) C++ in a betterC mode
>
> People who use C are not really interested in exceptions. EH 
> adds overhead (there is no such thing as zero cost exceptions).
>
>

I disagree:

1. Exceptions can be done "you do not use it, you do not pay for 
them". Also, compiler switches to diable exceptions totally exist 
in most compilers.

2. Expceptions can be implemented in such a way that the run-time 
cost, when used ,is minimal.

3. In several extensive C programs I seen, expception handling 
was used. A poor man's version implemented with setjmp/longjmp, 
but neverthless was there. And it was very well used, it was not 
code done by somone who learned a gimmick and abused it 
everywhere. It was the sanest way to handle errors in that 
portion of the code. The use was confined where needed.

4. Windows C compilers long had access to SEH mechanisms. 
__except{} __finally{}  where might usefull. This is yet another 
form of exception handling. It was used extensivly by people 
workin on NT platform. It was even used in kernel code, if you 
look in kernel you can find handlers for try/finally in a lot of 
places.  Yes, NT's kernel engineers agreed that in some places it 
was well worth to pay the run-time cost.

5. When I wrote for unices, the thing I missed most in C as 
compared to writting in C for NT was SEH support. It really 
solved some problems very elgantly, and as Im sure you agree 
__finally is very valuable, after all you put it in D with a 
different syntax.


More information about the Digitalmars-d mailing list