5 ms·
int64_t is a userspace libc typedef. long long is ICO C (C99) and guaranteed to be 64 bits or more.
by sirclueless 13y ago
int64_t is a userspace libc typedef. long long is ICO C (C99) and guaranteed to be 64 bits or more.
- alextingle 13y agoSo stdint.h not available to kernel programmers. Thanks.
- pslam 13y agoI always found this special-casing of headers for kernel vs user unnecessary and complicating. In the many embedded runtimes I maintain, I've moved towards using standard POSIX-y and C(++) standard headers everywhere. I know kernel folks love to believe that their world is special so all the usual C library stuff needs to be done differently, but it's not needed. It's so much easier to port code between the two worlds when you don't have to litter the #include prelude of every C file with conditionals.
- _kst_ 13y agostdint.h may not be available, but int64_t is; it's defined in include/linux/types.h.
- alayne 13y agoThe OpenBSD kernel probably doesn't use Linux headers.
- asveikau 13y agoA few times I got flamed on this site for complaining that the average HNer can't have reasonable discussions about C. I think the comment that the OpenBSD team should just #include <linux/types.h> pretty well shows that I was right. :-)
- _kst_ 13y agoJust a silly mistake on my part.
- cbsmith 13y agoReally going out on a limb there aren't you? ;-)
- _kst_ 13y agoYeah, good point. I'm not familiar with the OpenBSD kernel. Is there any good reason (for OpenBSD or any other kernel) why <stdint.h> shouldn't be available -- or at least why int64_t shouldn't be available in some header?
- _kst_ 13y ago<time.h> is userspace. It's at least theoretically possible for long long to be more than 64 bits. Why use long long (potentially, say, 128 bits) rather than int64_t for time_t? And why wouldn't int64_t be available in kernel space?
- dmm 13y agolong long can be printed in printf with the "%lld" flag.
- mrb 13y agoint64_t is in the ICO C(C99) standard: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n869/n869.pdf.gz http://www.open-std.org/jtc1/sc22/wg14/www/docs/n869/n869.pd...