[fpc-other] Microsoft to ban Memcpy() :)
"Vinzent Höfler"
JeLlyFish.software at gmx.net
Sat May 16 12:44:56 CEST 2009
"Vinzent Höfler" <JeLlyFish.software at gmx.net>:
> 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? :->
The C(++)-folks fix:
-- 8< --
inline void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t count)
{
if (count > sizeInBytes)
throw InvalidArgument("memcpy_s: buffer overflow");
memcpy(dest, src, count);
}
-- 8< --
LMAO. Adding unnecessary bounds checking on each single call. So much for the speed advantage of a low-level language. A pascal compiler knows the correct sizes beforehand, no need for extra bounds checking...
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