Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: 8 bit cpu Date: Tue, 23 Dec 2025 19:35:03 -0800 Organization: None to speak of Lines: 41 Message-ID: <87cy448sd4.fsf@example.invalid> References: <10ifejl$mj2o$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Wed, 24 Dec 2025 03:35:04 +0000 (UTC) Injection-Info: dont-email.me; posting-host="fafb48b540a2fff724766d529c113127"; logging-data="794647"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18CFJGVyUtQnZYlf+xJIl5m" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:8oU9v0yQN9xb1jTFp0cTXcMmhPU= sha1:CyU8CnfXZQ8l0GEOP0kvV/XQD34= Xref: csiph.com comp.lang.c:395925 kalevi@kolttonen.fi (Kalevi Kolttonen) writes: [...] > I do not know whether C standards permit 8-bit ints, It does not. C (up to C17) requires INT_MIN to be -32767 or lower, and INT_MAX to be +32767 or higher. (C23 changes the requirement for INT_MIN from -32767 to -32768, and mandates 2's-complement for signed integer types.) > but > cc65 is a real-world 6502 C cross-compiler available straight > from the standard repositories on Fedora Linux 43 and FreeBSD 15. > > We can install cc65 and VICE emulator to do a simple test: [...] I have cc65 on my Ubuntu system. Here's how I demonstrated the same thing (that sizeof (int) is 2): $ cat c.c int SIZEOF_INT = sizeof (int); $ cc65 c.c $ cat c.s ; ; File generated by cc65 v 2.18 - Ubuntu 2.19-1 ; .fopt compiler,"cc65 v 2.18 - Ubuntu 2.19-1" .setcpu "6502" [7 lines deleted] .export _SIZEOF_INT .segment "DATA" _SIZEOF_INT: .word $0002 $ -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */