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


Groups > comp.lang.c > #404172

Re: p = {1,0,0}

From bartc <bc@freeuk.com>
Newsgroups comp.lang.c
Subject Re: p = {1,0,0}
Date 2026-11-10 01:11 +0000
Organization A noiseless patient Spider
Message-ID <11ctr0o$1or07$1@dont-email.me> (permalink)
References (19 earlier) <11cpnbb$97kp$1@dont-email.me> <11cpo21$9fji$1@dont-email.me> <11cpov5$9q2h$1@dont-email.me> <11cq3hb$dnf9$1@dont-email.me> <11ctijh$1mb1u$1@dont-email.me>

Show all headers | View raw


On 09/11/2026 22:47, fir wrote:
> yet maybe some thoughts on for loop syntax potential improvements
> 
> 
> 
> 
> 
> 
> im really annoyed by long c loops
> like for(int i=0; i<100; i++) {}

So am I.

> back hen i miraculously mabe found some good alternative but it needs
> unicode

But there are a million ways to have a shorter syntax without needing to 
resort to Unicode.

Have you looked at /any/ other at languages at all? Take some ideas from 
those.

> 100š¢ {}Ā  //is alternative for "for(int i=0; i<100; i++) {}"

   for i<100 {}

might do it too. But I'd prefer 'for i=0,100 {}'.

> if f() is a function call then
> 
> f();f();f();f();f();f();f();f();
> 
> resembles loop thus
> 
> f()^10 may be understand as a kinda "natural" form of loop
> 

So a repeat-N-times loop. Try ntimes 10 {}

> so
> 
> int i =0; {a[i++]==0? break} ^ strlen(a);
> 
> might be seen as kinda natural
> (probably thought here strlen would be called many tiles so maybe
> 
> int LEN = strlen(a);
> int i =0; {a[i++]==0? break} ^ LEN;

How you have a loop that iterates over 0 to LEN-1, and yet you still 
have a repeat-N-times loop and need to manually initialise and step the 
index?

Try the idea from above (upper limit is exclusive):

   for i=0,strlen(a) {a[i]==0 ? break}

(I won't comment on that ? construct.)


> its not bad still its a bit long, has no shorter form and also
> there is a problem power has no leftsde form like 2^10 has not a form
> "10th power of 2" though maybe some could vrite ^10 {2}
> 
> so some shortcut form i could consider
> 
> i^100 {tab[i]=0}

   for i=1,100 {tab[i]=0}


> its not quite as natural asĀ  {tab[i++]=0}^100 but maybe its standable as 

What's natural about ^ meaning iteration? In C it means bitwise 
exclusive or. In other languages it might mean pow() or pointer deref.

(Remember your example above was f();f();f() not f()*f()*f().)

> its based on idea of power and adds some to it
> 
> i even noticed this sole sign "^" could be read as "for"
> 
> i^100 would mean power given blockĀ  100 times and i treat as a number of 
> this powering
> 
> i^10..99 { tab[i] = 0; }
> 
> ( or { tab[i] = 0; } i^10..99 )

  for i=10,100 {tab[i] = 0}

Everyone can see it is a for loop.


> 
> im not sure if this is enough good but thoseĀ  two syntaxes
> (one using this unicode indexes in minimal form) and this based on
> ascii is what i'm about currently
> 
> some could be worried that now this i as index is not an "int i"
> only enigmatic i - but im not sure if such special thing as index of the 
> loop (which is kinda low level thing should be necessary a clasical int 
> i..maybe it shouldnt?

A loop index is definitely a thing, just not in C because it is so 
backward. Even Fortran had it in the 1950s:

    do x i=1,100                 # inclusive range

(x is a label for the end of the loop as it didn't have block syntax yet.)

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


Thread

p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-01 14:32 +0100
  Re: p = {1,0,0} bartc <bc@freeuk.com> - 2026-11-01 13:41 +0000
    Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-01 15:10 +0100
      Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-01 16:13 +0100
        Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-02 16:46 +0100
    Re: p = {1,0,0} David Brown <david.brown@hesbynett.no> - 2026-11-02 17:36 +0100
      Re: p = {1,0,0} bartc <bc@freeuk.com> - 2026-11-02 18:47 +0000
        Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-02 20:54 +0100
          Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-02 20:56 +0100
        Re: p = {1,0,0} David Brown <david.brown@hesbynett.no> - 2026-11-02 21:29 +0100
          Re: p = {1,0,0} Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-11-02 21:39 +0100
          Re: p = {1,0,0} bartc <bc@freeuk.com> - 2026-11-02 22:58 +0000
            Re: p = {1,0,0} David Brown <david.brown@hesbynett.no> - 2026-11-03 11:09 +0100
            Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 13:19 +0100
              Re: p = {1,0,0} bartc <bc@freeuk.com> - 2026-11-03 14:07 +0000
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 15:45 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 15:54 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 16:48 +0100
            Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 14:29 +0100
              Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 14:42 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 16:09 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 16:18 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 16:38 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 16:55 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 17:06 +0100
                Re: p = {1,0,0} bartc <bc@freeuk.com> - 2026-11-03 16:26 +0000
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 17:34 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 17:47 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 17:54 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 22:08 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-04 14:14 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-04 14:27 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-05 19:10 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-05 19:38 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-07 20:14 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-07 20:18 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-07 20:19 +0100
                Re: p = {1,0,0} Richard Harnden <richard.nospam@gmail.invalid> - 2026-11-08 09:29 +0000
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-07 20:24 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-07 20:26 +0100
                Re: p = {1,0,0} bartc <bc@freeuk.com> - 2026-11-07 22:18 +0000
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-08 04:17 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-07 20:50 +0100
                Re: p = {1,0,0} bartc <bc@freeuk.com> - 2026-11-07 22:23 +0000
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-08 04:20 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-08 04:36 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-08 04:46 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-08 16:20 +0100
                Re: p = {1,0,0} bartc <bc@freeuk.com> - 2026-11-08 17:18 +0000
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-08 19:17 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-08 19:36 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-08 19:41 +0100
                Re: p = {1,0,0} bartc <bc@freeuk.com> - 2026-11-08 11:19 +0000
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-08 12:44 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-08 12:56 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-08 13:12 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-08 16:12 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-09 23:47 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-09 23:56 +0100
                Re: p = {1,0,0} bartc <bc@freeuk.com> - 2026-11-10 01:11 +0000
                Re: p = {1,0,0} David Brown <david.brown@hesbynett.no> - 2026-11-10 09:24 +0100
                Re: p = {1,0,0} bartc <bc@freeuk.com> - 2026-11-10 12:08 +0000
                Re: p = {1,0,0} David Brown <david.brown@hesbynett.no> - 2026-11-10 13:50 +0100
                Re: p = {1,0,0} bartc <bc@freeuk.com> - 2026-11-10 13:53 +0000
                while() and do/while() Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-11-10 11:47 -0800
                Re: while() and do/while() bartc <bc@freeuk.com> - 2026-11-10 20:33 +0000
                Re: p = {1,0,0} Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-11-10 04:29 -0800
                Re: p = {1,0,0} David Brown <david.brown@hesbynett.no> - 2026-11-10 13:57 +0100
                Re: p = {1,0,0} Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-11-10 08:57 -0800
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 13:51 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 14:08 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 14:17 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 14:22 +0100
                Re: p = {1,0,0} bartc <bc@freeuk.com> - 2026-11-10 14:27 +0000
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 15:32 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 15:44 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 15:51 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 16:10 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 16:24 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 16:38 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 16:54 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 17:09 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 17:16 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 17:20 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 15:09 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 15:13 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 15:17 +0100
                Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-10 15:24 +0100
      Re: p = {1,0,0} Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-11-02 14:52 -0800
        Re: p = {1,0,0} fir <profesor.fir@gmail.com> - 2026-11-03 13:29 +0100

csiph-web