Re: 2.1.80 miscellanea

Thomas Sailer (sailer@ife.ee.ethz.ch)
Thu, 22 Jan 1998 10:27:09 +0100


Jim Bourne wrote:
>
> On Wed, 21 Jan 1998, Michael Elizabeth Chastain wrote:
>
> > The new code fails to null-terminate the strings if the strings
> > are too long (this is better than the old code though!) I think
> > you need these lines:
> >
> > info.id[sizeof(info.id)-1] = '\0';
> >
> > indo.name[sizeof(info.name)-1] = '\0';
>
> Hi,
> Correct me if I'm wrong, but what if the size of a char is *not* one byte as
> Linux is ported to more hardware platforms then any other OS that I know of.
>
> Should these not be
> ...
> info.id[(sizeof(info.id)-1) * sizeof(char)] = '\0';
> ...
>
> Just thought it might be more portable this way.

The short answer: Hopefully, such architectures have something
less stupid than ISA DMA and therefore need a completely different
sound driver :-)

The longer answer: name an example please. For example, on
Motorola 56k using GCC (not that Linux will ever run on such
a platform, an address space of 3*64kWords and no MMU isn't enough
:-)) char is the same as int, and both are 24bits wide.
But sizeof(char) == sizeof(int) == 1, so this would work
even there.

Tom

PS: The same goes for Analog Devices SHARC.