Re: Poll: SizeOf(variable) vs SizeOf(type), should SizeOf(variable)be banned ?
- From: Rob Kennedy <me3@xxxxxxxxxxx>
- Date: Sat, 05 Jan 2008 12:23:30 -0600
Skybuck Flying wrote:
SizeOf(Buffer);
What if Buffer is changed from a static array to a dynamic array.
Putting the type name there instead wouldn't help any. The size of a dynamic array is always 4.
SizeOf doesn't work for dynamic arrays.
Another reason why not to use SizeOf like that.
One main reason I started to program in TurboPascal and later Delphi is that it's more easy to change code in Delphi without running into all kinds of stupid changes and/or bugs everywhere, sometimes some smartness is needed as well.
Using SizeOf on static buffers is clearly not very smart <- bug prone.
OK. So don't do that. Nothing to do with the issue at hand, though.
--
Rob
.
- Follow-Ups:
- Re: Poll: SizeOf(variable) vs SizeOf(type), should SizeOf(variable)be banned ?
- From: Skybuck Flying
- Re: Poll: SizeOf(variable) vs SizeOf(type), should SizeOf(variable)be banned ?
- References:
- Poll: SizeOf(variable) vs SizeOf(type), should SizeOf(variable) be banned ?
- From: Skybuck Flying
- Re: Poll: SizeOf(variable) vs SizeOf(type), should SizeOf(variable) be banned ?
- From: Rob Kennedy
- Re: Poll: SizeOf(variable) vs SizeOf(type), should SizeOf(variable)be banned ?
- From: Rudy Velthuis
- Re: Poll: SizeOf(variable) vs SizeOf(type), should SizeOf(variable)be banned ?
- From: Skybuck Flying
- Poll: SizeOf(variable) vs SizeOf(type), should SizeOf(variable) be banned ?
- Prev by Date: Re: Destructor in delphi dll - noob question
- Next by Date: Re: Poll: Scrap new and dispose from the language ?
- Previous by thread: Re: Poll: SizeOf(variable) vs SizeOf(type), should SizeOf(variable)be banned ?
- Next by thread: Re: Poll: SizeOf(variable) vs SizeOf(type), should SizeOf(variable)be banned ?
- Index(es):
Relevant Pages
|