Subject: Re: Data types in kernel-compatible code
To: Simon Burge <simonb@wasabisystems.com>
From: Florian Stoehr <netbsd@wolfnode.de>
List: tech-kern
Date: 01/03/2005 10:48:11
On Sat, 1 Jan 2005, Simon Burge wrote:

> Florian Stoehr wrote:
>
>> for normal I always program in c++, not pure c.
>>
>> I have a question regarding data types used in kernel or other
>> code in the netbsd project.
>>
>> For written data (to file) in my programs, I use the "int32_t" or
>> "uint32_t" types.
>>
>> Is it okay to use those types (from /usr/include/sys/stdint.h) in
>> "netbsd-compatible" code, regarding the style?
>
> The C99 types (intN_t, uintN_t) are preferred, both in the kernel and
> in userland.

OK, good!

I was in doubt cause I didn't see that in /usr/share/misc/style.

>
>> (I read "u_long" somewhere)?
>
> u_long/long, especially for data written to files, isn't going to be
> compatible across 32- and 64-bit platforms.
>

Yep, as I expected -> Found in disksub.c for amiga -> It doesn't matter 
there, but I don't like it.

I was just in doubt whether "u_long" is a typedef to the guaranteed 32-bit 
type or not. It's not -> OK

Fine, that answered my questions. Thank you!

> Simon.
> --
> Simon Burge                            <simonb@wasabisystems.com>
> NetBSD Support and Service:         http://www.wasabisystems.com/
>