Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #59950

Re: primitive instruction for programming

From Bartc <bc@freeuk.com>
Newsgroups comp.lang.c
Subject Re: primitive instruction for programming
Date 2015-04-13 10:59 +0100
Organization A noiseless patient Spider
Message-ID <mgg401$mdk$1@dont-email.me> (permalink)
References <e2dba237-d8d7-4dc3-a977-2b28b7c1e386@googlegroups.com>

Show all headers | View raw


On 13/04/2015 08:56, asetofsymbols@gmail.com wrote:
> The primitive instruction for
> programming wrote in C
>   it would be defined as:
>
> #define G(a,b) if(a)goto b
>
> With that and using labels
> each if() or loops
> can be made.
> There is not need other control
> path structure...
> Goto win 🏆:)
> G(1,m) would be goto
>
> If it is better than loop we can
> try... Post some C code and I
> would translate that in
> code use that macro...

You're right, I took this simple set of loops:

int count,n,a,b,c;

count=0;
n=500;
for (a=1; a<=n; ++a)
    for (b=a; b<=n; ++b)
       for (c=b; c<=n*2; ++c)
          if (a*a+b*b==c*c)
             ++count;


printf("Count = %d\n",count);

and turned it into this:

#define G(a,b) if(a) goto b
int a;
int b;
int c;
int n;
int m;
int count;

  n = 500;
  count = 0;
L2:
  a = 1;
  G (n < 1, L5);
L3:
  b = a;
  G (b > n, L9);
L7:
  c = b;
  G (c > n*2, L13);
L11:
  G (a*a+b*b != c*c, L14);
  ++count;
L14:
  ++c;
  G (c <= n*2, L11);
L13:
  ++b;
  G (b <= n, L7);
L9:
  ++a;
  G (a <= n, L3);
L5:
  printf("Count= %d\n",count);

It works perfectly! Thanks.

-- 
Bartc

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

primitive instruction for programming asetofsymbols@gmail.com - 2015-04-13 00:56 -0700
  Re: primitive instruction for programming Richard Heathfield <rjh@cpax.org.uk> - 2015-04-13 09:24 +0100
    Re: primitive instruction for programming asetofsymbols@gmail.com - 2015-04-13 01:59 -0700
      Re: primitive instruction for programming Richard Heathfield <rjh@cpax.org.uk> - 2015-04-13 10:32 +0100
        Re: primitive instruction for programming asetofsymbols@gmail.com - 2015-04-13 02:53 -0700
          Re: primitive instruction for programming Bartc <bc@freeuk.com> - 2015-04-13 11:04 +0100
          Re: primitive instruction for programming David Brown <david.brown@hesbynett.no> - 2015-04-13 14:10 +0200
            Re: primitive instruction for programming Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-20 14:27 -0700
              Re: primitive instruction for programming Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-20 15:12 -0700
                Re: primitive instruction for programming Bartc <bc@freeuk.com> - 2015-04-21 00:17 +0100
                Re: primitive instruction for programming Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-22 11:07 -0700
              Re: primitive instruction for programming David Brown <david.brown@hesbynett.no> - 2015-04-21 09:04 +0200
                Re: primitive instruction for programming Robert Wessel <robertwessel2@yahoo.com> - 2015-04-21 03:02 -0500
                Re: primitive instruction for programming asetofsymbols@gmail.com - 2015-04-21 01:34 -0700
                Re: primitive instruction for programming David Brown <david.brown@hesbynett.no> - 2015-04-21 11:34 +0200
                Re: primitive instruction for programming Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-04-21 11:48 +0100
                Re: primitive instruction for programming David Brown <david.brown@hesbynett.no> - 2015-04-21 13:10 +0200
                Re: primitive instruction for programming Bartc <bc@freeuk.com> - 2015-04-21 10:53 +0100
    Re: primitive instruction for programming Bartc <bc@freeuk.com> - 2015-04-13 20:09 +0100
      Re: primitive instruction for programming asetofsymbols@gmail.com - 2015-04-13 12:48 -0700
      Re: primitive instruction for programming David Brown <david.brown@hesbynett.no> - 2015-04-14 09:40 +0200
        Re: primitive instruction for programming Bartc <bc@freeuk.com> - 2015-04-14 11:24 +0100
          Re: primitive instruction for programming Robert Wessel <robertwessel2@yahoo.com> - 2015-04-14 05:39 -0500
          Re: primitive instruction for programming David Brown <david.brown@hesbynett.no> - 2015-04-14 13:29 +0200
  Re: primitive instruction for programming Bartc <bc@freeuk.com> - 2015-04-13 10:59 +0100
    Re: primitive instruction for programming asetofsymbols@gmail.com - 2015-04-13 03:28 -0700
      Re: primitive instruction for programming asetofsymbols@gmail.com - 2015-04-13 03:33 -0700
        Re: primitive instruction for programming asetofsymbols@gmail.com - 2015-04-13 03:59 -0700
          Re: primitive instruction for programming asetofsymbols@gmail.com - 2015-04-13 04:23 -0700
      Re: primitive instruction for programming Bartc <bc@freeuk.com> - 2015-04-13 11:36 +0100
        Re: primitive instruction for programming asetofsymbols@gmail.com - 2015-04-13 04:26 -0700
          Re: primitive instruction for programming Bartc <bc@freeuk.com> - 2015-04-13 12:41 +0100
            Re: primitive instruction for programming asetofsymbols@gmail.com - 2015-04-13 06:26 -0700
              Re: primitive instruction for programming David Brown <david.brown@hesbynett.no> - 2015-04-13 15:33 +0200
                Re: primitive instruction for programming asetofsymbols@gmail.com - 2015-04-13 06:44 -0700
                Re: primitive instruction for programming David Brown <david.brown@hesbynett.no> - 2015-04-13 16:30 +0200
                Re: primitive instruction for programming Ian Collins <ian-news@hotmail.com> - 2015-04-14 07:52 +1200
                Re: primitive instruction for programming David Brown <david.brown@hesbynett.no> - 2015-04-14 09:47 +0200
                Re: primitive instruction for programming raltbos@xs4all.nl (Richard Bos) - 2015-04-14 08:10 +0000
                Re: primitive instruction for programming David Brown <david.brown@hesbynett.no> - 2015-04-14 10:40 +0200
        Re: primitive instruction for programming Steve Thompson <stevet810@gmail.com> - 2015-04-13 17:52 +0000
          Re: primitive instruction for programming Robert Wessel <robertwessel2@yahoo.com> - 2015-04-13 18:20 -0500
            Re: primitive instruction for programming Robert Wessel <robertwessel2@yahoo.com> - 2015-04-13 18:33 -0500
              Re: primitive instruction for programming Steve Thompson <stevet810@gmail.com> - 2015-04-14 19:51 +0000
          Re: primitive instruction for programming Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-16 09:04 -0700
            Re: primitive instruction for programming Steve Thompson <stevet810@gmail.com> - 2015-04-17 02:25 +0000
              Re: primitive instruction for programming Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-04-17 08:34 -0700
                Re: primitive instruction for programming Bartc <bc@freeuk.com> - 2015-04-17 17:49 +0100
                Re: primitive instruction for programming Steve Thompson <stevet810@gmail.com> - 2015-04-17 19:06 +0000
                Re: primitive instruction for programming Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-04-17 20:45 -0700
                Re: primitive instruction for programming Steve Thompson <stevet810@gmail.com> - 2015-04-18 16:43 +0000
                Re: primitive instruction for programming Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-04-18 09:56 -0700
                Re: primitive instruction for programming Stephen Sprunk <stephen@sprunk.org> - 2015-04-17 17:52 -0500
                Re: primitive instruction for programming Morris Dovey <mrdovey@iedu.com> - 2015-04-17 18:02 -0500
                Re: primitive instruction for programming Stephen Sprunk <stephen@sprunk.org> - 2015-04-17 19:26 -0500
                Re: primitive instruction for programming Morris Dovey <mrdovey@iedu.com> - 2015-04-17 20:04 -0500
                Re: primitive instruction for programming Michael Angelo Ravera <maravera@prodigy.net> - 2015-04-19 14:59 -0700
                Re: primitive instruction for programming Richard Heathfield <rjh@cpax.org.uk> - 2015-04-20 00:19 +0100
                Re: primitive instruction for programming Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-04-20 02:06 +0100
                Re: primitive instruction for programming Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-04-20 02:26 +0100
                Re: primitive instruction for programming Richard Heathfield <rjh@cpax.org.uk> - 2015-04-20 02:18 +0100
              Re: primitive instruction for programming Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-18 18:59 -0700
                Re: primitive instruction for programming Steve Thompson <stevet810@gmail.com> - 2015-04-19 16:28 +0000
                Re: primitive instruction for programming Richard Damon <Richard@Damon-Family.org> - 2015-04-19 17:16 -0400
                Re: primitive instruction for programming Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-22 15:28 -0700
          Re: primitive instruction for programming John Bode <jfbode1029@gmail.com> - 2015-04-23 07:20 -0700
  Re: primitive instruction for programming fmassei@gmail.com - 2015-04-13 03:07 -0700
    Re: primitive instruction for programming asetofsymbols@gmail.com - 2015-04-13 09:47 -0700
      Re: primitive instruction for programming fmassei@gmail.com - 2015-04-13 11:09 -0700
        Re: primitive instruction for programming Noob <root@127.0.0.1> - 2015-04-13 20:43 +0200
          Re: primitive instruction for programming fmassei@gmail.com - 2015-04-13 12:09 -0700
            Re: primitive instruction for programming Xcott Craver <xcottcraver@gmail.com> - 2015-04-14 07:11 -0700
              Re: primitive instruction for programming fmassei@gmail.com - 2015-04-14 07:28 -0700
                Re: primitive instruction for programming Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-04-14 15:57 +0100
                Re: primitive instruction for programming fmassei@gmail.com - 2015-04-14 08:13 -0700
      Re: primitive instruction for programming fir <profesor.fir@gmail.com> - 2015-04-13 14:02 -0700
        Re: primitive instruction for programming asetofsymbols@gmail.com - 2015-04-13 14:28 -0700
          Re: primitive instruction for programming Bartc <bc@freeuk.com> - 2015-04-13 22:51 +0100
            Re: primitive instruction for programming fmassei@gmail.com - 2015-04-13 14:58 -0700
              Re: primitive instruction for programming Bartc <bc@freeuk.com> - 2015-04-13 23:25 +0100
                Re: primitive instruction for programming fmassei@gmail.com - 2015-04-13 15:37 -0700
                Re: primitive instruction for programming James Kuyper <jameskuyper@verizon.net> - 2015-04-13 19:09 -0400
                Re: primitive instruction for programming fmassei@gmail.com - 2015-04-13 16:20 -0700
                Re: primitive instruction for programming Robert Wessel <robertwessel2@yahoo.com> - 2015-04-13 18:03 -0500
            Re: primitive instruction for programming asetofsymbols@gmail.com - 2015-04-13 20:58 -0700
          Re: primitive instruction for programming fir <profesor.fir@gmail.com> - 2015-04-13 15:02 -0700

csiph-web