*BSD News Article 15385


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!uunet!pipex!sunic!isgate!veda.is!adam
From: adam@veda.is (Adam David)
Newsgroups: comp.os.386bsd.development
Subject: Re: Correction, Correction, Appologizes.....
Keywords: error correction qic news
Message-ID: <C6AEyD.Hrr@veda.is>
Date: 30 Apr 93 08:15:35 GMT
References: <jmonroyC6A4u2.LL4@netcom.com>
Organization: Veda Systems, Iceland
Lines: 39

jmonroy@netcom.com (Jesus Monroy Jr) writes:

[edited for brevity]
>        #define STOP            2
>        #define GO              1

>            while (move & (STOP | GO))
>            {   move = external_stuff;
>                ::
>                ::
>                /* this is implicit logic, it works just like the previous */
>                move &= (STOP | GO);
>            }

Maybe the optimising compiler would fix this code but it is ugly. What about...

             while (move &= STOP | GO)
             {   move = external_stuff;
                 ::
                 ::
             }

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

[note: #define CORRECTION means it is not corrected yet]

>            glob_err = (sec_no >= sectors_pertrack) ? { head++; sec_no = 0;} :
                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
Yumm, yumm! A compiler with anonymous inline functions.

>#ifdef CORRECTION
>                        (head > head_pertrack) ? {seek(track++); head = 0;}:;
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Oooh! And it also has a default component for the ?: operator.
Non-standard, but it might have uses if anyone would dare to implement it in
a compiler.

:-)