Re: CoCo OS-9 C compilers - ANSI?
Jeff Teunissen via Coco <[email protected]> Fri, 19 Jun 2026 14:23:53 -0400
| Newsgroups | gmane.comp.hardware.tandy.coco |
|---|---|
| Message-ID | <CACuf1ii_MdvrhH_9T6O5-5XXXs=B+_VejFBvZyY=7bhiUSRS=g@mail.gmail.com> |
--===============0937469954509824058== Content-Type: multipart/alternative; boundary="000000000000d3c44706549f65f3" --000000000000d3c44706549f65f3 Content-Type: text/plain; charset="UTF-8" On Thu, May 14, 2026, 17:04 Allen Huffman via Coco < [email protected]> wrote: > I recall back in the 90s, Vaughn Cato (? I think ?) created ANSIFront for > the OS-9 compiler. It allowed ANSI-like stuff with functions to be done int > he old pre-ANSI K&R C compiler. > > All my old CoCo and MM/1 OS-9 stuff is K&R since that is the compiler I > had on both systems. > > I would like to clean up my old C source code. > > What is the recommended C toolchain to be using these days for OS-9/6809 > stuff? > Like Curtis said, DCC (found in my CoCo C repo at < https://github.com/Deek/CoCoC>) is more up to date and friendly to work with and has fewer bugs. The preprocessor, dcpp, should be C99-compatible, with variadic macros and modern token pasting and 'stringification', where the old preprocessor didn't even have "#if expression". That is to say, you should be able to do something like: #if (!defined(NDEBUG)) // debugging code included by default # define dprintf(...) fprintf(stderr, __VA_ARGS__) #else # define dprintf(...) #endif That said, the language still isn't ANSI. Prototypes are not supported, and structs still have only one namespace. My current project, in my free time, is to resurrect the 2-pass version of the compiler so that there's space to add processing for prototypes, limited struct member uniqueness, and const (which will shrink binaries but make accidental self-modifying code possible). Patches on anything are welcome. --000000000000d3c44706549f65f3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto"><div><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D= "gmail_attr">On Thu, May 14, 2026, 17:04 Allen Huffman via Coco <<a href= =3D"mailto:[email protected]" target=3D"_blank" rel=3D"noreferrer">= [email protected]</a>> wrote:<br></div><blockquote class=3D"gmai= l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,20= 4,204);padding-left:1ex"><div>I recall back in the 90s, Vaughn Cato (? I th= ink ?) created ANSIFront for the OS-9 compiler. It allowed ANSI-like stuff = with functions to be done int he old pre-ANSI K&R C compiler.<div><br><= /div><div>All my old CoCo and MM/1 OS-9 stuff is K&R since that is the = compiler I had on both systems.</div><div><br></div><div>I would like to cl= ean up my old C source code.</div><div><br></div><div>What is the recommend= ed C toolchain to be using these days for OS-9/6809 stuff?</div></div></blo= ckquote></div></div><div dir=3D"auto"><br></div><div dir=3D"auto">Like Curt= is said, DCC (found in my CoCo C repo at=C2=A0 <<a href=3D"https://githu= b.com/Deek/CoCoC" target=3D"_blank" rel=3D"noreferrer">https://github.com/D= eek/CoCoC</a>>) is more up to date and friendly to work with and has few= er bugs.</div><div dir=3D"auto"><br></div><div dir=3D"auto">The preprocesso= r, dcpp, should be C99-compatible, with variadic macros and modern token pa= sting and 'stringification', where the old preprocessor didn't = even have "#if expression". That is to say, you should be able to= do something like:</div><div dir=3D"auto"><br></div><div dir=3D"auto">#if = (!defined(NDEBUG)) // debugging code included by default</div><div dir=3D"a= uto"># define dprintf(...) fprintf(stderr, __VA_ARGS__)</div><div dir=3D"au= to">#else</div><div dir=3D"auto"># define dprintf(...)</div><div dir=3D"aut= o">#endif</div><div dir=3D"auto"><br></div><div dir=3D"auto">That said, the= language still isn't ANSI. Prototypes are not supported, and structs s= till have only one namespace. My current project, in my free time, is to re= surrect the 2-pass version of the compiler so that there's space to add= processing for prototypes, limited struct member uniqueness, and const (wh= ich will shrink binaries but make accidental self-modifying code possible).= </div><div dir=3D"auto"><br></div><div dir=3D"auto">Patches on anything are= welcome.</div><div dir=3D"auto"></div></div> --000000000000d3c44706549f65f3-- --===============0937469954509824058== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- Coco mailing list [email protected] http://listserv.adelphi.edu/cgi-bin/mailman/listinfo/coco --===============0937469954509824058==--