Inherent code performance advantages of D over C?

Walter Bright newshound2 at digitalmars.com
Sat Dec 14 11:45:58 PST 2013


On 12/14/2013 9:39 AM, H. S. Teoh wrote:
> On Fri, Dec 13, 2013 at 06:01:10PM -0800, Walter Bright wrote:
>> On 12/13/2013 6:52 AM, Dicebot wrote:
> I was so scarred from the experience that when I saw that D supported
> unicode natively, I was totally sold.

Funny story about that. Before I started D, I worked on a C++ project that had 
to work with Unicode. I ran into all the same issues you did, and also decided 
that wchar_t was unusable with Unicode. I spent a lot of time getting the 
Unicode stuff to work correctly. I was so scarred from the experience (!) that I 
decided that proper Unicode support was an absolute must for D.


>>>> 12. forward referencing (no need to declare everything twice)
>>> Not an issue. C programmers are not tired from typing.
>>
>> C programs tend to be written "bottom up" to avoid forward
>> references. This is not convenient.
>
> I still do that even in D programs, because DMD's handling of forward
> references is, shall we say, quirky? It works most of the time, but
> sometimes you get odd errors because certain symbol resolution
> algorithms used by dmd will produce unexpected results if you don't
> declare certain symbols beforehand. So it's not completely order-free,
> but also not completely order-dependent, but something nebulous in
> between. Me, I play it safe and just write things the C way, so that I
> never run into these kinds of issues.

dmd's forward reference issues come from a bad design choice in the compiler 
implementation. I've been gradually fixing the design, and things have gotten a 
lot better. For example, with the latest release you can forward reference enum 
members, even in the same enum definition!



More information about the Digitalmars-d mailing list