:: Re: [DNG] simple-netaid from scratc…
Página Principal
Delete this message
Reply to this message
Autor: Didier Kryn
Data:  
Para: dng
Assunto: Re: [DNG] simple-netaid from scratch
Le 10/06/2019 à 16:01, s@po a écrit :
> 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 ;)
>

\begin{pedantic}
    The size used by the layout of the data (sizeof()) has not the same
meaning as the number of elements. AFAIK, the C language does not
specify (at least not completely) the data layout and leaves it to the
implementation.
    All modern hardware lay out data as bit octets and compilers use
one octet of bits to represent an ASCII character (note 7 would suffice
for ASCII). All compilers layout strings in contiguous successive octets.
    Therefore there is little chance that the confusion between size
and number of elements be harmfull. Yet there is a subtle difference :~)
\end{pedantic}

    Didier