:: Re: [DNG] simple-netaid from scratc…
Kezdőlap
Delete this message
Reply to this message
Szerző: Steve Litt
Dátum:  
Címzett: dng
Tárgy: Re: [DNG] simple-netaid from scratch
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?

It's funny. So many times people advocate jumping through hoops to save
a millisecond in a program operated by and therefore bottlenecked by a
100wpm typist. 100wpm is 500 keystrokes per minute, or 8.33 keystrokes
per second, which means each keystroke takes 120 milliseconds. The 1ms
savings *just doesn't matter*.

And yes, as a matter of fact, I often do use "useless use of cat".
Costs me nothing perceptible, and makes it easier to rearrange
pipelines til I get them right.


SteveT

Steve Litt
June 2019 featured book: Thriving in Tough Times
http://www.troubleshooters.com/thrive