[fpc-other] Microsoft to ban Memcpy() :)

"Vinzent Höfler" JeLlyFish.software at gmx.net
Sat May 16 12:29:41 CEST 2009


Jonas Maebe <jonas.maebe at elis.ugent.be>:

> And of course, the move() procedure in FPC/TP/Delphi has exactly the  
> same problems as memcpy() as far as bounds-unsafety is concerned (it's  
> similar with fillchar/memset, indexbyte/memchr, etc).

True. But in contrast to C an average programmer doesn't need it very often. In Pascal there are easier ways to assign arrays to each other than doing a raw byte copy. ;)

But I still fail to see the advantage of

void * memcpy_s (       void * destination,
                        size_t dest_size,
                  const void * source,
                        size_t num );

vs. the original:

void * memcpy (       void * destination,
                const void * source,
                      size_t num );

Time will tell, if memcpy_s() is actually "safer". If the programmer didn't think about the destination buffer's size before, why should he now? :->


Vinzent.
-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a


More information about the fpc-other mailing list