Post about comparing C, C++ and D performance with a real world project
Steven Schveighoffer
schveiguy at yahoo.com
Sat Dec 9 14:00:16 UTC 2017
On 12/9/17 5:55 AM, Kagamin wrote:
> On Thursday, 7 December 2017 at 21:38:57 UTC, Daniel Kozak wrote:
>> Yes using FILE* directly could be the way. But using file.rawRead is
>> still possible. But it is better to use static array with length one.
>
> This can reflect absence of middle level resources like basic
> optimization techniques for D - it's too complex for tour and too
> obvious for experts. For interoperability with FILE* one must be really
> familiar with slices: remember in C arrays just work. And when one hears
> about memory allocation optimization in D one thinks about ranges, which
> is a bit involved already.
Yes, it would be nice to have a "If you do this in C, here's how you do
it in D" guide. It could be part of the tour, for sure. Just tag it
intermediate.
In terms of arrays, they aren't much different in D than in C. Just with
better checks for safety. In fact, you can use C arrays (T*) in D just
fine, with the same syntax and problems.
-Steve
More information about the Digitalmars-d
mailing list