Re: Goto?!? (was Re: A89: fwrite bug located (and a bugfix))


[Prev][Next][Index][Thread]

Re: Goto?!? (was Re: A89: fwrite bug located (and a bugfix))




Hi!

> Somebody PLEASE tell me why you're using _GOTO_ there before
> Wing and I die of laughter?!?

> Geez, you're breaking the ultimate C taboo here - the only
> accepted use of goto involves breaking out of nested loops
> with faster/smaller code, but that doesn't apply in this 
> instance - I can do it without goto, and I bet it'll 
> generate the same code.

See, I am a teacher of Principles of Programming (in Pascal
and C++) and I never suggest to my students to use goto. But,
in tigcc programming I have no tabus: everything is legal if
produce a working code. When I tried various implementations
of fread/fwrite, I noticed that the implementation with goto
produces the shortest code, so I decided to accept just
this variant.

> It's a question of whether or not this will generate the 
> same code - a good test of how smart GCC is.  Can it optimize
> this code into the equivalent goto'd form, without using a 
> dreaded goto? hmmm. . .

I will check it. By the way, tigcc is smart, but not very
smart. It is more smart than a lot of C compilers for PC, and
much more smart than (unknown) C compiler used by Texas
Instruments to produce TIOS, but it is surely not as smart
as it should be.

Zeljko