Autor: Jim Jackson Fecha: A: dng Asunto: Re: [DNG] simple-netaid from scratch
On Tue, 11 Jun 2019, Steve Litt wrote:
> On Mon, 10 Jun 2019 15:01:53 +0100
> s@po <tuxd3v@???> wrote:
>
> > On Mon, 10 Jun 2019 13:34:54 +0100 (BST)
> > Jim Jackson <jj@???> wrote:
> >
> > >
> > > sizeof() is calculated by the compiler, not at run time. The code
> > > generated would be the same.
> >
> > Hello Jim,
> > Indeed it his, my point was only a observation, that if size is
> > fixed, no need to calculate it at compile time, the preprocessor can
> > solve that with a macro.. The code generated will be indeed the same.
> > Only was a observation ;)
>
> I vote for leaving it as a function.
>
> What would be gained by making it a macro? A microsecond? What are the
> bottlenecks of the software? Are keyboard or mouse input involved?
>
> If these sizeof() calls are deep in a tight nested loop, by all means
> make them into a macro. Otherwise, why give up the simplicity of a
> function for the sometimes edge case weirdness of a macro?
I do wish people would read. Those sizeof()'s are not executable functions,
they are calculated by the compiler at compile time into their fixed
numbers and inserted into the code as fixed numbers, just as a macro would!
There is no difference at runtime. The code generated would be identical.