Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #1323
| From | federation2005@netzero.com |
|---|---|
| Newsgroups | comp.compilers |
| Subject | How to type braces for computed gotos (was: Best "simple" C Compiler I've ever seen) |
| Date | 2014-07-18 14:44 -0700 |
| Organization | Compilers Central |
| Message-ID | <14-07-033@comp.compilers> (permalink) |
| References | <14-05-013@comp.compilers> |
On Sunday, May 4, 2014 8:23:05 PM UTC-5, andrewc...@gmail.com wrote: > https://github.com/rui314/8cc > Self hosting, extremely well written, and seems geared towards simple > but complete code rather than being a complicated monolith. On that count: usually when I redo a source (reformat, reanalyze the math, make more effective use of the language, etc.) it comes out to 50% reduction by lines 30% by bytes; which is consistent across thousands of source files. The only exceptions I've encountered to date are stuff I earlier reduced (30% by lines if it made use of an earlier dialect of the language), stuff from AT&T (which does not reduce much, e.g. CFront) and the source for this compiler. So by that count, it's well-written and compact. There is one feature the compiler tests for that I assume the language also has in it that I haven't seen much of before: the computed goto. What's I don't quite understand how the branches are being typed. A computed goto inside a void routine has the branches typed (void *), with the individual items accessed in effect as references to (void *). The branches are essentially continuations. So the question here is how are continuations being typed. From the example used in the distribution, either (A) all continuations are typed (void *) or they are being typed (T *) when they occur inside a function that returns type T. [That's an extension. In standard C, you can only goto a label. -John Perhaps it's similar to this GCC extension https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html#Labels-as-Values]
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Best "simple" C Compiler I've ever seen andrewchamberss@gmail.com - 2014-05-04 18:23 -0700
Re: Best "simple" C Compiler I've ever seen federation2005@netzero.com - 2014-06-30 12:42 -0700
How to type braces for computed gotos (was: Best "simple" C Compiler I've ever seen) federation2005@netzero.com - 2014-07-18 14:44 -0700
Re: How to type braces for computed gotos glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-07-19 02:21 +0000
Re: How to type braces for computed gotos Ivan Godard <ivan@ootbcomp.com> - 2014-07-18 21:59 -0700
Re: How to type braces for computed gotos federation2005@netzero.com - 2014-07-21 10:32 -0700
Re: How to type braces for computed gotos (was: Best "simple" C Compiler I've ever seen) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-07-21 11:45 +0000
Re: How to type braces for computed gotos glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-07-21 16:19 +0000
Re: How to type braces for computed gotos wclodius@earthlink.net (William Clodius) - 2014-07-21 21:44 -0600
Re: How to type braces for computed gotos glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-07-23 00:35 +0000
Re: How to type braces for computed gotos wclodius@earthlink.net (William Clodius) - 2014-07-22 22:36 -0600
Re: How to type braces for computed gotos anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-07-25 22:38 -0400
csiph-web