Compiled dmd2.032 in VC++ 2009!

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Sep 6 06:38:17 PDT 2009


Jeremie Pelletier wrote:
> Rainer Deyke Wrote:
> 
>> Jeremie Pelletier wrote:
>>> bearophile Wrote:
>>>> - if(de.name[$-2 .. $] == ".c") is a bit unsafe, (...)
>>> I don't see how unsafe that is in this context.
>> Potential buffer underrun.
>> http://www.digitalmars.com/d/1.0/arrays.html: "A program may not rely on
>> array bounds checking happening"
>>
>>
>> -- 
>> Rainer Deyke - rainerd at eldwood.com
> 
> Oh yeah, didn't think about that one here. I usually test for the string length before slicing it.

Probably the way I'd recommend to carry the test is de.name.endsWith(".c").

Andrei



More information about the Digitalmars-d mailing list