Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"They ought to make butt-flavored cat food." --Gallagher


devel / comp.lang.c / Re: if(!(i%16))

SubjectAuthor
* if(!(i%16))fir
`* Re: if(!(i%16))bart
 `* Re: if(!(i%16))fir
  `* Re: if(!(i%16))bart
   `* Re: if(!(i%16))fir
    `* Re: if(!(i%16))fir
     `- Re: if(!(i%16))fir

1
if(!(i%16))

<uua137$3in1a$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34882&group=comp.lang.c#34882

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: if(!(i%16))
Date: Sat, 30 Mar 2024 22:44:11 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <uua137$3in1a$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 30 Mar 2024 21:44:07 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3759146"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: fir - Sat, 30 Mar 2024 21:44 UTC

void bytes_dump_in_hex()
{
for(int i=0; i<bytes_size; i++)
{
if(!(i%16)) printf("\n");

printf("%02x ", bytes[i]);
}
}

in the code above seem that those inner () in if(!(i%16)) are needed

why is that so?

Re: if(!(i%16))

<uua45d$18naj$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34883&group=comp.lang.c#34883

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (bart)
Newsgroups: comp.lang.c
Subject: Re: if(!(i%16))
Date: Sat, 30 Mar 2024 22:36:30 +0000
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <uua45d$18naj$1@dont-email.me>
References: <uua137$3in1a$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 30 Mar 2024 22:36:30 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2a39a4f275d14f8fd4fa1a15ff029e85";
logging-data="1334611"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+h0pEkb0kNzIzCC3pYrvYd"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:AxxwY50DvIFgTD2s1C37NDuAd0A=
In-Reply-To: <uua137$3in1a$1@i2pn2.org>
Content-Language: en-GB
 by: bart - Sat, 30 Mar 2024 22:36 UTC

On 30/03/2024 21:44, fir wrote:
>  void bytes_dump_in_hex()
>   {
>     for(int i=0; i<bytes_size; i++)
>     {
>       if(!(i%16)) printf("\n");
>
>       printf("%02x ", bytes[i]);
>     }
>   }
>
> in the code above seem that those inner () in if(!(i%16)) are needed
>
> why is that so?

Without them !i%16 will be parsed as (!i)%16.

Re: if(!(i%16))

<uua4uh$3irjh$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34884&group=comp.lang.c#34884

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: if(!(i%16))
Date: Sat, 30 Mar 2024 23:49:59 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <uua4uh$3irjh$1@i2pn2.org>
References: <uua137$3in1a$1@i2pn2.org> <uua45d$18naj$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 30 Mar 2024 22:49:53 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3763825"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <uua45d$18naj$1@dont-email.me>
 by: fir - Sat, 30 Mar 2024 22:49 UTC

bart wrote:
> On 30/03/2024 21:44, fir wrote:
>> void bytes_dump_in_hex()
>> {
>> for(int i=0; i<bytes_size; i++)
>> {
>> if(!(i%16)) printf("\n");
>>
>> printf("%02x ", bytes[i]);
>> }
>> }
>>
>> in the code above seem that those inner () in if(!(i%16)) are needed
>>
>> why is that so?
>
> Without them !i%16 will be parsed as (!i)%16.
>
and does it have sense?

if ! is boolean operator and % is arithmetic then converting things to
bolean and then do arithmetoc on it seems not much reasonable...

overally isnt arithmetoc stronger than boolean like a*b < c*d ?

Re: if(!(i%16))

<uua7hj$19ih8$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34887&group=comp.lang.c#34887

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (bart)
Newsgroups: comp.lang.c
Subject: Re: if(!(i%16))
Date: Sat, 30 Mar 2024 23:34:12 +0000
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <uua7hj$19ih8$1@dont-email.me>
References: <uua137$3in1a$1@i2pn2.org> <uua45d$18naj$1@dont-email.me>
<uua4uh$3irjh$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 30 Mar 2024 23:34:12 +0100 (CET)
Injection-Info: dont-email.me; posting-host="7b5aaa18bb1f33420505e79397e7ce40";
logging-data="1362472"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/oqR7QlUgzkzGH1M6LoWsT"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:c5Z8r2/HLg6Rd/7fbG6L5F6qjGg=
In-Reply-To: <uua4uh$3irjh$1@i2pn2.org>
Content-Language: en-GB
 by: bart - Sat, 30 Mar 2024 23:34 UTC

On 30/03/2024 22:49, fir wrote:
> bart wrote:
>> On 30/03/2024 21:44, fir wrote:
>>>   void bytes_dump_in_hex()
>>>    {
>>>      for(int i=0; i<bytes_size; i++)
>>>      {
>>>        if(!(i%16)) printf("\n");
>>>
>>>        printf("%02x ", bytes[i]);
>>>      }
>>>    }
>>>
>>> in the code above seem that those inner () in if(!(i%16)) are needed
>>>
>>> why is that so?
>>
>> Without them !i%16 will be parsed as (!i)%16.
>>
> and does it have sense?

It's a unary operator. Usually they are applied before binary ones. So
'++ p + n' means '(++p)+n' not '++(p+n)' which wouldn't work anyway.

And -2-3 means (-2)-3 or -5, not -(2-3) which would be +1.

However whether it makes sense is beside the point. It's how C has
always worked.

> if ! is boolean operator and % is arithmetic then converting things to
> bolean and then do arithmetoc on it seems  not much reasonable...

Some people think that ! should work like that, so that here:

not a<b and b<c

the 'not' applies to the entire expression: not(a<b and b<c), rather
than (not a)<b and b<c.

But honestly, there are lots of things that are worse about C's set of
precedences.

Re: if(!(i%16))

<uubrel$3kpld$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34891&group=comp.lang.c#34891

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: if(!(i%16))
Date: Sun, 31 Mar 2024 16:20:11 +0200
Organization: i2pn2 (i2pn.org)
Message-ID: <uubrel$3kpld$1@i2pn2.org>
References: <uua137$3in1a$1@i2pn2.org> <uua45d$18naj$1@dont-email.me> <uua4uh$3irjh$1@i2pn2.org> <uua7hj$19ih8$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 31 Mar 2024 14:20:05 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3827373"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <uua7hj$19ih8$1@dont-email.me>
 by: fir - Sun, 31 Mar 2024 14:20 UTC

bart wrote:
> On 30/03/2024 22:49, fir wrote:
>> bart wrote:
>>> On 30/03/2024 21:44, fir wrote:
>>>> void bytes_dump_in_hex()
>>>> {
>>>> for(int i=0; i<bytes_size; i++)
>>>> {
>>>> if(!(i%16)) printf("\n");
>>>>
>>>> printf("%02x ", bytes[i]);
>>>> }
>>>> }
>>>>
>>>> in the code above seem that those inner () in if(!(i%16)) are needed
>>>>
>>>> why is that so?
>>>
>>> Without them !i%16 will be parsed as (!i)%16.
>>>
>> and does it have sense?
>
> It's a unary operator. Usually they are applied before binary ones. So
> '++ p + n' means '(++p)+n' not '++(p+n)' which wouldn't work anyway.
>
> And -2-3 means (-2)-3 or -5, not -(2-3) which would be +1.
>
> However whether it makes sense is beside the point. It's how C has
> always worked.
>
>> if ! is boolean operator and % is arithmetic then converting things to
>> bolean and then do arithmetoc on it seems not much reasonable...
>
> Some people think that ! should work like that, so that here:
>
> not a<b and b<c
>
> the 'not' applies to the entire expression: not(a<b and b<c), rather
> than (not a)<b and b<c.
>
> But honestly, there are lots of things that are worse about C's set of
> precedences.
>
i remember i answered then go to sleep now i dont see my answer

never thinked on this operator precedences but as i said for sure
thise "relative" (< > ==) and logical (and or not) should be last
after bitwise (and or xor not) and arithmetic (+-*/%)
and this is as i say no matter of they do like that but the fact
thet the output of relatives and logical is boleean and boolean is not
to much use (if any) for arithmetic of bitwise - so this is for sure

relative should be before logical becouse for example

a<10 & a>-10 //say % is logical ias for me there is damn error in c and
& should be logical and && eventually could be bitwise

is common usage (so fron this 4 types mentioned logical is 4.
and relative is 3. )

as to arythmetic vs bitwice

7*9 & 78+90

im not sure

bitwise generally not fit here to much at all (to all 3 arithmetic,
logical, and relative..so possiby as this is a bit outside here
it ebventually could go first to beoutside it

like

a&0xff+b&0xff00+c&0xff0000

common usage to work

so

1. bitwise
2. arithmetic
3. relative
4. logical

Re: if(!(i%16))

<uubt68$3krq7$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34892&group=comp.lang.c#34892

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: if(!(i%16))
Date: Sun, 31 Mar 2024 16:49:49 +0200
Organization: i2pn2 (i2pn.org)
Message-ID: <uubt68$3krq7$1@i2pn2.org>
References: <uua137$3in1a$1@i2pn2.org> <uua45d$18naj$1@dont-email.me> <uua4uh$3irjh$1@i2pn2.org> <uua7hj$19ih8$1@dont-email.me> <uubrel$3kpld$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 31 Mar 2024 14:49:46 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3829575"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <uubrel$3kpld$1@i2pn2.org>
 by: fir - Sun, 31 Mar 2024 14:49 UTC

fir wrote:
> bart wrote:
>> On 30/03/2024 22:49, fir wrote:
>>> bart wrote:
>>>> On 30/03/2024 21:44, fir wrote:
>>>>> void bytes_dump_in_hex()
>>>>> {
>>>>> for(int i=0; i<bytes_size; i++)
>>>>> {
>>>>> if(!(i%16)) printf("\n");
>>>>>
>>>>> printf("%02x ", bytes[i]);
>>>>> }
>>>>> }
>>>>>
>>>>> in the code above seem that those inner () in if(!(i%16)) are needed
>>>>>
>>>>> why is that so?
>>>>
>>>> Without them !i%16 will be parsed as (!i)%16.
>>>>
>>> and does it have sense?
>>
>> It's a unary operator. Usually they are applied before binary ones. So
>> '++ p + n' means '(++p)+n' not '++(p+n)' which wouldn't work anyway.
>>
>> And -2-3 means (-2)-3 or -5, not -(2-3) which would be +1.
>>
>> However whether it makes sense is beside the point. It's how C has
>> always worked.
>>
>>> if ! is boolean operator and % is arithmetic then converting things to
>>> bolean and then do arithmetoc on it seems not much reasonable...
>>
>> Some people think that ! should work like that, so that here:
>>
>> not a<b and b<c
>>
>> the 'not' applies to the entire expression: not(a<b and b<c), rather
>> than (not a)<b and b<c.
>>
>> But honestly, there are lots of things that are worse about C's set of
>> precedences.
>>
> i remember i answered then go to sleep now i dont see my answer
>
> never thinked on this operator precedences but as i said for sure
> thise "relative" (< > ==) and logical (and or not) should be last
> after bitwise (and or xor not) and arithmetic (+-*/%)
> and this is as i say no matter of they do like that but the fact
> thet the output of relatives and logical is boleean and boolean is not
> to much use (if any) for arithmetic of bitwise - so this is for sure
>
> relative should be before logical becouse for example
>
> a<10 & a>-10 //say % is logical ias for me there is damn error in c and
> & should be logical and && eventually could be bitwise
>
> is common usage (so fron this 4 types mentioned logical is 4.
> and relative is 3. )
>
> as to arythmetic vs bitwice
>
> 7*9 & 78+90
>
> im not sure
>
> bitwise generally not fit here to much at all (to all 3 arithmetic,
> logical, and relative..so possiby as this is a bit outside here
> it ebventually could go first to beoutside it
>
> like
>
> a&0xff+b&0xff00+c&0xff0000
>
> common usage to work
>
> so
>
> 1. bitwise
> 2. arithmetic
> 3. relative
> 4. logical
>
>
>
there are yet assigment ones

a=b+c
for sure it should go after arithmetic and bitwise
it also should before relative becouse the same reason - assigment of
boolean is small use

so

1. bitwise
2. arithmetic
3. assigment
4. relative
5. logical

what else those lik . for member or * & for pointers should be first
(0.) and ?: should be lowest i guess

and how it look like in c:

arithmetic seem be higher then relational then bitwise then logical and
assigment but with some exceptions

2.(ar)4(rel).1(bit).5(logg).3.(assign)

2.4.5. is in order so one should ship bitwise and be aware of assigment

quite funny if i treat bitwisa & | as logical it still work
becouse at least

arithm < rel < log

assigment also shoudl work partially (as to arithmetic and new logical)

i would need to check it in practice what work as here above its written
much approximately

Re: if(!(i%16))

<uubtv2$3kstn$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34893&group=comp.lang.c#34893

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: if(!(i%16))
Date: Sun, 31 Mar 2024 17:03:05 +0200
Organization: i2pn2 (i2pn.org)
Message-ID: <uubtv2$3kstn$1@i2pn2.org>
References: <uua137$3in1a$1@i2pn2.org> <uua45d$18naj$1@dont-email.me> <uua4uh$3irjh$1@i2pn2.org> <uua7hj$19ih8$1@dont-email.me> <uubrel$3kpld$1@i2pn2.org> <uubt68$3krq7$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 31 Mar 2024 15:02:58 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3830711"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <uubt68$3krq7$1@i2pn2.org>
 by: fir - Sun, 31 Mar 2024 15:03 UTC

so yet in short the general

"ar rel log" (as it should be) seem to be preserved in c

there is problem with assigment that should be before rel and is last

there is also problem with bitwise (except they are use as logical)
as bitwise should b first and is after relative

and also this problem with logical not here spotted in title of the post
at should go after arithmetic and for some reason its not

it seems there is more right than wrong but are wew errors that need to
be listed than could be memorized

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor