Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"I have just one word for you, my boy...plastics." -- from "The Graduate"


computers / comp.os.vms / Re: C limitations, was: Re: VMS process communication

SubjectAuthor
* VMS process communicationArne Vajhøj
+* Re: VMS process communicationJohn Forkosh
|`- Re: VMS process communicationArne Vajhøj
+* Re: VMS process communicationDave Froble
|+* Re: VMS process communicationSingle Stage to Orbit
||`* Re: VMS process communicationCraig A. Berry
|| `* Re: VMS process communicationArne Vajhøj
||  +- Re: VMS process communicationDave Froble
||  +* Re: VMS process communicationArne Vajhøj
||  |`* Re: VMS process communicationJan-Erik Söderholm
||  | `* Re: VMS process communicationSingle Stage to Orbit
||  |  `* Re: VMS process communicationArne Vajhøj
||  |   `* Re: VMS process communicationJan-Erik Söderholm
||  |    +* Re: VMS process communicationArne Vajhøj
||  |    |`- Re: VMS process communicationArne Vajhøj
||  |    `- Re: VMS process communicationStephen Hoffman
||  `* Re: VMS process communicationArne Vajhøj
||   `* Re: VMS process communicationIan Miller
||    `* Re: VMS process communicationJohn Reagan
||     `* Re: VMS process communicationArne Vajhøj
||      `- Re: VMS process communicationArne Vajhøj
|+* Re: VMS process communicationMarc Van Dyck
||`- Re: VMS process communicationSingle Stage to Orbit
|`* Re: VMS process communicationLee Gleason
| +* Re: VMS process communicationDave Froble
| |`* Re: VMS process communicationRobert A. Brooks
| | +- Re: VMS process communicationDave Froble
| | `- Re: VMS process communicationRichard Maher
| `* Re: VMS process communicationArne Vajhøj
|  `* Re: VMS process communicationDave Froble
|   `* Re: VMS process communicationArne Vajhøj
|    +- Re: VMS process communicationStephen Hoffman
|    +- Re: VMS process communicationRichard Maher
|    `- Re: VMS process communicationDave Froble
+* Re: VMS process communicationBob Gezelter
|+* Re: VMS process communicationSimon Clubley
||`* Re: VMS process communicationBob Gezelter
|| `* Re: VMS process communicationDave Froble
||  `* Re: VMS process communicationStephen Hoffman
||   `* Re: VMS process communicationDave Froble
||    `* Re: VMS process communicationStephen Hoffman
||     `* Re: VMS process communicationDave Froble
||      `* Re: VMS process communicationSimon Clubley
||       `* Re: VMS process communicationDave Froble
||        `- Re: VMS process communicationFred. Zwarts
|+- Re: VMS process communicationStephen Hoffman
|`- Re: VMS process communicationArne Vajhøj
+* Re: VMS process communicationMarc Van Dyck
|`* Re: VMS process communicationArne Vajhøj
| +- Re: VMS process communicationCraig A. Berry
| `* Re: VMS process communicationDave Froble
|  +- Re: VMS process communicationArne Vajhøj
|  `* Re: VMS process communicationJan-Erik Söderholm
|   `* Re: VMS process communicationRichard Maher
|    +* Re: VMS process communicationDave Froble
|    |`- Re: VMS process communicationRichard Maher
|    +* Re: VMS process communicationArne Vajhøj
|    |`* Re: VMS process communicationArne Vajhøj
|    | `* Re: VMS process communicationSimon Clubley
|    |  `- Re: VMS process communicationArne Vajhøj
|    `* Re: VMS process communicationStephen Hoffman
|     `* Re: VMS process communicationRichard Maher
|      `- Re: VMS process communicationStephen Hoffman
`* Re: VMS process communicationArne Vajhøj
 +* Re: VMS process communicationSimon Clubley
 |`* Re: VMS process communicationArne Vajhøj
 | `* Re: VMS process communicationArne Vajhøj
 |  +* Re: VMS process communicationCraig A. Berry
 |  |+* Re: VMS process communicationArne Vajhøj
 |  ||`* Re: VMS process communicationSimon Clubley
 |  || `* Re: VMS process communicationArne Vajhøj
 |  ||  `* Re: VMS process communicationSimon Clubley
 |  ||   +* Re: VMS process communicationArne Vajhøj
 |  ||   |`* Re: VMS process communicationDave Froble
 |  ||   | +- Re: VMS process communicationArne Vajhøj
 |  ||   | `* Re: VMS process communicationSimon Clubley
 |  ||   |  `* Re: VMS process communicationDave Froble
 |  ||   |   `* Re: VMS process communicationArne Vajhøj
 |  ||   |    +* Re: VMS process communicationArne Vajhøj
 |  ||   |    |`* Re: VMS process communicationSimon Clubley
 |  ||   |    | `* Re: VMS process communicationArne Vajhøj
 |  ||   |    |  `- Re: VMS process communicationSimon Clubley
 |  ||   |    `* Re: VMS process communicationbill
 |  ||   |     +* Re: VMS process communicationArne Vajhøj
 |  ||   |     |`* Re: VMS process communicationSteven Schweda
 |  ||   |     | `* Re: VMS process communicationArne Vajhøj
 |  ||   |     |  +* Re: VMS process communicationSteven Schweda
 |  ||   |     |  |+* Re: VMS process communicationScott Dorsey
 |  ||   |     |  ||+* Re: VMS process communicationSteven Schweda
 |  ||   |     |  |||`- Re: VMS process communicationArne Vajhøj
 |  ||   |     |  ||`- Re: VMS process communicationArne Vajhøj
 |  ||   |     |  |`- Re: VMS process communicationArne Vajhøj
 |  ||   |     |  `* Re: VMS process communicationDave Froble
 |  ||   |     |   +- Re: VMS process communicationSteven Schweda
 |  ||   |     |   `* Re: VMS process communicationArne Vajhøj
 |  ||   |     |    +- Re: VMS process communicationDave Froble
 |  ||   |     |    +* Re: VMS process communicationSteven Schweda
 |  ||   |     |    |`- Re: VMS process communicationArne Vajhøj
 |  ||   |     |    `* Re: VMS process communicationJohnny Billquist
 |  ||   |     |     +* Re: VMS process communicationSteven Schweda
 |  ||   |     |     |`* Re: VMS process communicationJohnny Billquist
 |  ||   |     |     +* Re: VMS process communicationScott Dorsey
 |  ||   |     |     `* Re: VMS process communicationArne Vajhøj
 |  ||   |     `- Re: VMS process communicationDave Froble
 |  ||   `- Re: VMS process communicationJohnny Billquist
 |  |`* Re: VMS process communicationCraig A. Berry
 |  +* Re: VMS process communicationAndreas Gruhl
 |  +* Re: VMS process communicationJOUKJ
 |  +- Re: VMS process communicationSimon Clubley
 |  `* Re: VMS process communicationArne Vajhøj
 `- Re: VMS process communicationArne Vajhøj

Pages:123456789
Re: C limitations, was: Re: VMS process communication

<tvt4jf$b82$1@news.misty.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27272&group=comp.os.vms#27272

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!.POSTED.80-218-16-84.dclient.hispeed.ch!not-for-mail
From: bqt...@softjar.se (Johnny Billquist)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Tue, 28 Mar 2023 00:16:15 +0200
Organization: MGT Consulting
Message-ID: <tvt4jf$b82$1@news.misty.com>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 27 Mar 2023 22:16:16 -0000 (UTC)
Injection-Info: news.misty.com; posting-host="80-218-16-84.dclient.hispeed.ch:80.218.16.84";
logging-data="11522"; mail-complaints-to="abuse@misty.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.9.0
Content-Language: en-US
In-Reply-To: <tvs23c$37d4e$1@dont-email.me>
 by: Johnny Billquist - Mon, 27 Mar 2023 22:16 UTC

On 2023-03-27 14:27, Simon Clubley wrote:
> On 2023-03-25, Scott Dorsey <kludge@panix.com> wrote:
>> bill <bill.gunshannon@gmail.com> wrote:
>>> I knew there was. I just find it funny that everyone holds that
>>> idea up as the very worst thing in C and yet, as you said, it was
>>> the industry standard long before C came around. Had C done it
>>> differently I am sure people would have bitched about abandoning
>>> the current standard.
>>
>> Quite possibly, but they would have had a lot fewer buffer overrun
>> vulnerabilities while doing so.
>>
>> I am a big fan of C and I definitely think null-terminated strings
>> were a mistake. There are syntax issues in C that I don't like, but
>> there is nothing in the same order of magnitude as null terminated
>> strings.
>>
>> But, at the time C was made, the notion that people would attempt to
>> deliberately cause software to malfunction seemed alien. It no longer
>> is, and as the world has changed the design decisions that seem appropriate
>> may have changed as well.
>
> In this very different world, gets() was once considered to be an acceptable
> function. :-)

That one is bad in a way that is hard to defend.

> In the more recent world, strncpy() is not always guaranteed to write
> a terminating null. Absolutely no excuse for that one :-(, especially
> given that it was supposed to be a fix for strcpy() (IIRC).

Agreed that this is sortof very annoying, but the workaround is
exceedingly simple. So I tend to just be annoyed by it, but it don't
really cause any problems if you just are aware of it.

> Other annoyances (apart from the null-terminated strings):
>
> = for assignment, versus == for comparison. (At least it's not PHP however,
> where you need to use === to get a sane comparison. :-))
>
> enums are integers, not a type.

Not sure I consider the enum thing to be much of a deal. Unless we
compare to Ada, which is the only language I've seen which really do
enums properly as its own type.

> Functions are public unless marked as static. I would have preferred them
> to be private by default with the need for a "public" keyword to make the
> function visible to the linker.

I could agree with that. Not that I think it's a big deal, and I can see
people becoming very annoyed had it been the other way around as well.

> signed characters are the default.

Actually, this one is worse. char is implementation defined if it is
signed or not (really - the standard says so).
If you think/assume they are signed, you're asking for it...

Johnny

Re: C limitations, was: Re: VMS process communication

<tvt4po$b82$2@news.misty.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27273&group=comp.os.vms#27273

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!.POSTED.80-218-16-84.dclient.hispeed.ch!not-for-mail
From: bqt...@softjar.se (Johnny Billquist)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Tue, 28 Mar 2023 00:19:35 +0200
Organization: MGT Consulting
Message-ID: <tvt4po$b82$2@news.misty.com>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvs58m$37kh8$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 27 Mar 2023 22:19:36 -0000 (UTC)
Injection-Info: news.misty.com; posting-host="80-218-16-84.dclient.hispeed.ch:80.218.16.84";
logging-data="11522"; mail-complaints-to="abuse@misty.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.9.0
Content-Language: en-US
In-Reply-To: <tvs58m$37kh8$1@dont-email.me>
 by: Johnny Billquist - Mon, 27 Mar 2023 22:19 UTC

On 2023-03-27 15:21, Arne Vajhøj wrote:
> On 3/27/2023 8:27 AM, Simon Clubley wrote:
>> = for assignment, versus == for comparison. (At least it's not PHP
>> however,
>> where you need to use === to get a sane comparison. :-))
>
> C == is not that great either.

[...]

Not sure I understand what your issue with C == was here.
You got a bunch of warnings for comparing mismatching types, which was
to be expected. I failed to see any problems beyond that.

This has nothing to do with == as such, but with with C type system.
This is how the type system is defined to work.

One might argue that this is bad, but in this case, I would say it's
pretty reasonable. (As opposed to the promotion of unsigned to signed
that can happen, which we had a thread about a couple of weeks ago...)

Johnny

Re: C limitations, was: Re: VMS process communication

<tvt6ck$3dnj0$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27274&group=comp.os.vms#27274

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Mon, 27 Mar 2023 18:46:44 -0400
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <tvt6ck$3dnj0$1@dont-email.me>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 27 Mar 2023 22:46:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6b9a8c796b8a914464a4956889414580";
logging-data="3595872"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/6E3nHEiT4sF7oET82fybAkV6VY4LW96g="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:xx+7VE7ZitjIezM6IBOdklLEa3s=
Content-Language: en-US
In-Reply-To: <tvt4jf$b82$1@news.misty.com>
 by: Arne Vajhøj - Mon, 27 Mar 2023 22:46 UTC

On 3/27/2023 6:16 PM, Johnny Billquist wrote:
> On 2023-03-27 14:27, Simon Clubley wrote:
>> enums are integers, not a type.
>
> Not sure I consider the enum thing to be much of a deal. Unless we
> compare to Ada, which is the only language I've seen which really do
> enums properly as its own type.

Java enums are also very much non-int.

Arne

Re: C limitations, was: Re: VMS process communication

<tvt6dd$4h3$1@panix2.panix.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27275&group=comp.os.vms#27275

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!panix!.POSTED.panix2.panix.com!panix2.panix.com!not-for-mail
From: klu...@panix.com (Scott Dorsey)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: 27 Mar 2023 22:47:09 -0000
Organization: Former users of Netcom shell (1989-2000)
Lines: 25
Message-ID: <tvt6dd$4h3$1@panix2.panix.com>
References: <631fb9a1$0$703$14726298@news.sunsite.dk> <tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me> <tvt4jf$b82$1@news.misty.com>
Injection-Info: reader2.panix.com; posting-host="panix2.panix.com:166.84.1.2";
logging-data="2190"; mail-complaints-to="abuse@panix.com"
 by: Scott Dorsey - Mon, 27 Mar 2023 22:47 UTC

Johnny Billquist <bqt@softjar.se> wrote:
>On 2023-03-27 14:27, Simon Clubley wrote:
>> On 2023-03-25, Scott Dorsey <kludge@panix.com> wrote:
>>> bill <bill.gunshannon@gmail.com> wrote:
>>> I am a big fan of C and I definitely think null-terminated strings
>>> were a mistake. There are syntax issues in C that I don't like, but
>>> there is nothing in the same order of magnitude as null terminated
>>> strings.
>>>
>>> But, at the time C was made, the notion that people would attempt to
>>> deliberately cause software to malfunction seemed alien. It no longer
>>> is, and as the world has changed the design decisions that seem appropriate
>>> may have changed as well.
>>
>> In this very different world, gets() was once considered to be an acceptable
>> function. :-)
>
>That one is bad in a way that is hard to defend.

It was easy to defend in 1978. But we do not live in 1978 anymore.
--scott

--
"C'est un Nagra. C'est suisse, et tres, tres precis."

Re: C limitations, was: Re: VMS process communication

<tvt73r$3dniv$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27276&group=comp.os.vms#27276

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Mon, 27 Mar 2023 18:59:07 -0400
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <tvt73r$3dniv$1@dont-email.me>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvs58m$37kh8$1@dont-email.me> <tvt4po$b82$2@news.misty.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 27 Mar 2023 22:59:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6b9a8c796b8a914464a4956889414580";
logging-data="3595871"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/iYxYnsi1RtdyTQVDaLSpdoNNvlDceNKU="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:D8fkqQodffbJTY3m0TKtm2gFLw0=
Content-Language: en-US
In-Reply-To: <tvt4po$b82$2@news.misty.com>
 by: Arne Vajhøj - Mon, 27 Mar 2023 22:59 UTC

On 3/27/2023 6:19 PM, Johnny Billquist wrote:
> On 2023-03-27 15:21, Arne Vajhøj wrote:
>> On 3/27/2023 8:27 AM, Simon Clubley wrote:
>>> = for assignment, versus == for comparison. (At least it's not PHP
>>> however,
>>> where you need to use === to get a sane comparison. :-))
>>
>> C == is not that great either.
>
> [...]
>
> Not sure I understand what your issue with C == was here.
> You got a bunch of warnings for comparing mismatching types, which was
> to be expected. I failed to see any problems beyond that.

It gave warnings on zero int comparison with string and NULL. I
would prefer an error.

It accepted non-zero int comparison with string and NULL. I would like
an error.

It accepted int comparison with TRUE/FALSE. I would like
an error.

> This has nothing to do with == as such, but with with C type system.
> This is how the type system is defined to work.

Yes - a lot of it is due to the type system.

Arne

Re: C limitations, was: Re: VMS process communication

<tvt7u2$3e095$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27277&group=comp.os.vms#27277

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Mon, 27 Mar 2023 19:13:07 -0400
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <tvt7u2$3e095$1@dont-email.me>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com> <tvt6ck$3dnj0$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 27 Mar 2023 23:13:06 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6b9a8c796b8a914464a4956889414580";
logging-data="3604773"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19S+vP2wsmY1+spPK1+/kiH4g00vn/aqyA="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:IMKvLyiAlHJSxaWuSBGmoPOHq/Y=
Content-Language: en-US
In-Reply-To: <tvt6ck$3dnj0$1@dont-email.me>
 by: Arne Vajhøj - Mon, 27 Mar 2023 23:13 UTC

On 3/27/2023 6:46 PM, Arne Vajhøj wrote:
> On 3/27/2023 6:16 PM, Johnny Billquist wrote:
>> On 2023-03-27 14:27, Simon Clubley wrote:
>>> enums are integers, not a type.
>>
>> Not sure I consider the enum thing to be much of a deal. Unless we
>> compare to Ada, which is the only language I've seen which really do
>> enums properly as its own type.
>
> Java enums are also very much non-int.

And some languages require some "arm twisting"
to make enums work like integers.

VMS Pascal:

program enumchk(input,output);

type
direction = (north, south, west, east);
color = (red, green, blue, yellow);
material = (wood, iron, concrete);

var
d : direction;
c : color;
m : material;

begin
d := west;
c := green;
m := (ord(d) div ord(c))::material;
writeln(m);
end.

and C#:

using System;

namespace EnumChk
{ enum Direction { North, South, West, East }
enum Color { Red, Green, Blue, Yello }
enum Material { Wood, Iron, Concrete }
public class Program
{
public static void Main(string[] args)
{
Direction d = Direction.West;
Color c = Color.Green;
Material m = (Material)((int)d / (int)c);
Console.WriteLine(m);
Console.ReadKey();
}
}
}

both write concrete (different case), but one could
argue that the programmer asked for it.

Arne

Re: C limitations, was: Re: VMS process communication

<4b19ca379d935295930f6fb5ea59f983d617f2bd.camel@munted.eu>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27278&group=comp.os.vms#27278

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!palladium.buellnet!not-for-mail
From: alex.bu...@munted.eu (Single Stage to Orbit)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Tue, 28 Mar 2023 09:06:01 +0100
Organization: One very high maintenance cat
Message-ID: <4b19ca379d935295930f6fb5ea59f983d617f2bd.camel@munted.eu>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com>
Reply-To: alex.buell@munted.eu
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: solani.org;
logging-data="2825456"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Evolution 3.46.3
Cancel-Lock: sha1:TJsWi3HGXVQS1p+SaGK8s5oaV00=
X-User-ID: eJwFwYkBwCAIA8CVypMg4yia/UfoHYLGqSSYEPTK9FkwbzS2p3pGHXHvSW1kLu8Cu6vmgDbR5/FzCy1/wx9DFhTu
In-Reply-To: <tvt4jf$b82$1@news.misty.com>
 by: Single Stage to Orbi - Tue, 28 Mar 2023 08:06 UTC

On Tue, 2023-03-28 at 00:16 +0200, Johnny Billquist wrote:
> Actually, this one is worse. char is implementation defined if it is
> signed or not (really - the standard says so).
> If you think/assume they are signed, you're asking for it...

Which is why stdint.h (or cstdint) was invented with explicit types
(uint8_t, uint64_t etc)

But I also happen to agree zero terminated strings are evil.
--
Tactical Nuclear Kittens

Re: C limitations, was: Re: VMS process communication

<tvule3$3o289$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27279&group=comp.os.vms#27279

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: club...@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Tue, 28 Mar 2023 12:09:39 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <tvule3$3o289$1@dont-email.me>
References: <631fb9a1$0$703$14726298@news.sunsite.dk> <tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net> <tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me> <tvs58m$37kh8$1@dont-email.me> <tvt4po$b82$2@news.misty.com> <tvt73r$3dniv$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 28 Mar 2023 12:09:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b03b220b81e3c4b26c779ee3b3fe0f31";
logging-data="3934473"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX181MO1JwSzVc3UxP/acc2DfY4Xu7eQ4+jo="
User-Agent: slrn/0.9.8.1 (VMS/Multinet)
Cancel-Lock: sha1:rmsQwcZyXn+schMFwRmfxrbaiOA=
 by: Simon Clubley - Tue, 28 Mar 2023 12:09 UTC

On 2023-03-27, Arne Vajhøj <arne@vajhoej.dk> wrote:
> On 3/27/2023 6:19 PM, Johnny Billquist wrote:
>> On 2023-03-27 15:21, Arne Vajhøj wrote:
>>> On 3/27/2023 8:27 AM, Simon Clubley wrote:
>>>> = for assignment, versus == for comparison. (At least it's not PHP
>>>> however,
>>>> where you need to use === to get a sane comparison. :-))
>>>
>>> C == is not that great either.
>>
>> [...]
>>
>> Not sure I understand what your issue with C == was here.
>> You got a bunch of warnings for comparing mismatching types, which was
>> to be expected. I failed to see any problems beyond that.
>
> It gave warnings on zero int comparison with string and NULL. I
> would prefer an error.
>

Agreed, but you can at least turn warnings into errors in your build
procedures to force people to fix the warnings.

In Linux land, I _always_ use -Werror and the DEC C compiler has a
comparable qualifier as well.

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.

Re: C limitations, was: Re: VMS process communication

<tvulk2$3o289$2@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27280&group=comp.os.vms#27280

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: club...@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Tue, 28 Mar 2023 12:12:50 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <tvulk2$3o289$2@dont-email.me>
References: <631fb9a1$0$703$14726298@news.sunsite.dk> <tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net> <tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me> <tvt4jf$b82$1@news.misty.com> <tvt6ck$3dnj0$1@dont-email.me> <tvt7u2$3e095$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 28 Mar 2023 12:12:50 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b03b220b81e3c4b26c779ee3b3fe0f31";
logging-data="3934473"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/UPsvzbVQqbjbQ3pEbRNvmiQXh5upIm4E="
User-Agent: slrn/0.9.8.1 (VMS/Multinet)
Cancel-Lock: sha1:373KDNNE1yQjM3J/WBo84ov6Xe4=
 by: Simon Clubley - Tue, 28 Mar 2023 12:12 UTC

On 2023-03-27, Arne Vajhøj <arne@vajhoej.dk> wrote:
> m := (ord(d) div ord(c))::material;

Anyone writing _that_ line of code deserves to have their keyboard
permanently taken away from them. :-)

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.

Re: C limitations, was: Re: VMS process communication

<tvulqg$3o71m$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27281&group=comp.os.vms#27281

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Tue, 28 Mar 2023 08:16:14 -0400
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <tvulqg$3o71m$1@dont-email.me>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com>
<4b19ca379d935295930f6fb5ea59f983d617f2bd.camel@munted.eu>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 28 Mar 2023 12:16:16 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6b9a8c796b8a914464a4956889414580";
logging-data="3939382"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/8t3cD2R5VmJhsllQkenkmz6C70lDRTis="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:E8Zl1qdqKVhbwlYLhFOIME/hxPU=
In-Reply-To: <4b19ca379d935295930f6fb5ea59f983d617f2bd.camel@munted.eu>
Content-Language: en-US
 by: Arne Vajhøj - Tue, 28 Mar 2023 12:16 UTC

On 3/28/2023 4:06 AM, Single Stage to Orbit wrote:
> On Tue, 2023-03-28 at 00:16 +0200, Johnny Billquist wrote:
>> Actually, this one is worse. char is implementation defined if it is
>> signed or not (really - the standard says so).
>> If you think/assume they are signed, you're asking for it...
>
> Which is why stdint.h (or cstdint) was invented with explicit types
> (uint8_t, uint64_t etc)

They should be used.

Just note that the spec says "These types are optional.", but
I suspect that all the common platforms has them.

Arne

Re: C limitations, was: Re: VMS process communication

<tvv204$s7j$1@reader2.panix.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27282&group=comp.os.vms#27282

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cro...@spitfire.i.gajendra.net (Dan Cross)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Tue, 28 Mar 2023 15:44:04 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <tvv204$s7j$1@reader2.panix.com>
References: <631fb9a1$0$703$14726298@news.sunsite.dk> <k88rd6FmhttU1@mid.individual.net> <tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
Injection-Date: Tue, 28 Mar 2023 15:44:04 -0000 (UTC)
Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
logging-data="28915"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)
 by: Dan Cross - Tue, 28 Mar 2023 15:44 UTC

In article <tvs23c$37d4e$1@dont-email.me>,
Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:
>> [snip]
>
>In this very different world, gets() was once considered to be an acceptable
>function. :-)

Hey, it was finally removed from the C standard!

>In the more recent world, strncpy() is not always guaranteed to write
>a terminating null. Absolutely no excuse for that one :-(, especially
>given that it was supposed to be a fix for strcpy() (IIRC).

I agree with you, but this is not why strncpy() was introduced.
The name here is bad, but it was really intended for copying
string-like data into fixed-width _fields_ in data structures
(such as directory entries in the filesystem structures that are
written to secondary storage).

It has other patholical behavior, too: in particular, it touches
every byte in its output argument, regardless if the source is
shorter than that or not.

Modern replacements, like strlcpy/strlcat, are generally
preferable.

>Other annoyances (apart from the null-terminated strings):
>
>= for assignment, versus == for comparison. (At least it's not PHP however,
>where you need to use === to get a sane comparison. :-))

I mostly agree; syntax that can disambiguate between assignment
and comparison is better in a language like C that is loose in
the sense of allowing almost any expression in a boolean
context.

More modern languages "fix" this by just not punning arbitrary
arithmetic expressions to bools.

>enums are integers, not a type.

+1e6

>Functions are public unless marked as static. I would have preferred them
>to be private by default with the need for a "public" keyword to make the
>function visible to the linker.

Absolutely; same for data.

>signed characters are the default.

As Johnny pointed out, it's even worse! This is implementation
defined.

- Dan C.

Re: C limitations, was: Re: VMS process communication

<u01lop$scd$1@news.misty.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27283&group=comp.os.vms#27283

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!.POSTED.80-218-16-84.dclient.hispeed.ch!not-for-mail
From: bqt...@softjar.se (Johnny Billquist)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Wed, 29 Mar 2023 17:33:45 +0200
Organization: MGT Consulting
Message-ID: <u01lop$scd$1@news.misty.com>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvs58m$37kh8$1@dont-email.me> <tvt4po$b82$2@news.misty.com>
<tvt73r$3dniv$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 29 Mar 2023 15:33:46 -0000 (UTC)
Injection-Info: news.misty.com; posting-host="80-218-16-84.dclient.hispeed.ch:80.218.16.84";
logging-data="29069"; mail-complaints-to="abuse@misty.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.9.0
Content-Language: en-US
In-Reply-To: <tvt73r$3dniv$1@dont-email.me>
 by: Johnny Billquist - Wed, 29 Mar 2023 15:33 UTC

On 2023-03-28 00:59, Arne Vajhøj wrote:
> On 3/27/2023 6:19 PM, Johnny Billquist wrote:
>> On 2023-03-27 15:21, Arne Vajhøj wrote:
>>> On 3/27/2023 8:27 AM, Simon Clubley wrote:
>>>> = for assignment, versus == for comparison. (At least it's not PHP
>>>> however,
>>>> where you need to use === to get a sane comparison. :-))
>>>
>>> C == is not that great either.
>>
>> [...]
>>
>> Not sure I understand what your issue with C == was here.
>> You got a bunch of warnings for comparing mismatching types, which was
>> to be expected. I failed to see any problems beyond that.
>
> It gave warnings on zero int comparison with string and NULL. I
> would prefer an error.
>
> It accepted non-zero int comparison with string and NULL. I would like
> an error.
>
> It accepted int comparison with TRUE/FALSE. I would like
> an error.

Ah. So your complaint was about that. Well, it's not completely unheard
of to actually do such comparisons.
One need to understand that in C, "string" is just syntactic sugar.
When you have a string, in C all you have is an address. And an address
is a number.

So while it seems unlikely that you want to compare the two, it's
possibly something you'd want, hence warning. Same with NULL. It's just
an address, which is a number.

As Simon pointed out, you can request that such warnings be treated as
errors if you want to. But for some, it might actually be very intentional.

>> This has nothing to do with == as such, but with with C type system.
>> This is how the type system is defined to work.
>
> Yes - a lot of it is due to the type system.

And I think that in this case, it's not completely unreasonable how it
handles things. I consider a warning to be a good thing here. It might
be what the author intended. If so, he might want to rephrase it to not
get the warnings, or else consider the warnings as something flagging a
potential error.

It is not absolutely certain that this actually is an error. The author
needs to figure that out. The compiler can not.

Johnny

Re: C limitations, was: Re: VMS process communication

<u01m0b$scd$2@news.misty.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27284&group=comp.os.vms#27284

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!.POSTED.80-218-16-84.dclient.hispeed.ch!not-for-mail
From: bqt...@softjar.se (Johnny Billquist)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Wed, 29 Mar 2023 17:37:47 +0200
Organization: MGT Consulting
Message-ID: <u01m0b$scd$2@news.misty.com>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com> <tvt6ck$3dnj0$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 29 Mar 2023 15:37:48 -0000 (UTC)
Injection-Info: news.misty.com; posting-host="80-218-16-84.dclient.hispeed.ch:80.218.16.84";
logging-data="29069"; mail-complaints-to="abuse@misty.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.9.0
Content-Language: en-US
In-Reply-To: <tvt6ck$3dnj0$1@dont-email.me>
 by: Johnny Billquist - Wed, 29 Mar 2023 15:37 UTC

On 2023-03-28 00:46, Arne Vajhøj wrote:
> On 3/27/2023 6:16 PM, Johnny Billquist wrote:
>> On 2023-03-27 14:27, Simon Clubley wrote:
>>> enums are integers, not a type.
>>
>> Not sure I consider the enum thing to be much of a deal. Unless we
>> compare to Ada, which is the only language I've seen which really do
>> enums properly as its own type.
>
> Java enums are also very much non-int.

I can't remember Java enough to be sure, but I don't think they went as
far as Ada. What happens in Java if you print out the value of an enum
variable? Can you loop over it, and that is a loop that does not have an
integer loop counting? Can you read values into an enum, and do you then
type in the possible enums or else get an error? Can you use enums as
indexing in arrays? And nowhere does any numberness of the whole thing
shines through?

I thought Java was rather C-like...

Johnny

Re: C limitations, was: Re: VMS process communication

<u01m3v$scd$3@news.misty.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27285&group=comp.os.vms#27285

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!.POSTED.80-218-16-84.dclient.hispeed.ch!not-for-mail
From: bqt...@softjar.se (Johnny Billquist)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Wed, 29 Mar 2023 17:39:42 +0200
Organization: MGT Consulting
Message-ID: <u01m3v$scd$3@news.misty.com>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com> <tvt6dd$4h3$1@panix2.panix.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 29 Mar 2023 15:39:43 -0000 (UTC)
Injection-Info: news.misty.com; posting-host="80-218-16-84.dclient.hispeed.ch:80.218.16.84";
logging-data="29069"; mail-complaints-to="abuse@misty.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.9.0
Content-Language: en-US
In-Reply-To: <tvt6dd$4h3$1@panix2.panix.com>
 by: Johnny Billquist - Wed, 29 Mar 2023 15:39 UTC

On 2023-03-28 00:47, Scott Dorsey wrote:
> Johnny Billquist <bqt@softjar.se> wrote:
>> On 2023-03-27 14:27, Simon Clubley wrote:
>>> On 2023-03-25, Scott Dorsey <kludge@panix.com> wrote:
>>>> bill <bill.gunshannon@gmail.com> wrote:
>>>> I am a big fan of C and I definitely think null-terminated strings
>>>> were a mistake. There are syntax issues in C that I don't like, but
>>>> there is nothing in the same order of magnitude as null terminated
>>>> strings.
>>>>
>>>> But, at the time C was made, the notion that people would attempt to
>>>> deliberately cause software to malfunction seemed alien. It no longer
>>>> is, and as the world has changed the design decisions that seem appropriate
>>>> may have changed as well.
>>>
>>> In this very different world, gets() was once considered to be an acceptable
>>> function. :-)
>>
>> That one is bad in a way that is hard to defend.
>
> It was easy to defend in 1978. But we do not live in 1978 anymore.

I don't think it was defendable in 1978 either, but it was easy to use.

Johnny

Re: C limitations, was: Re: VMS process communication

<u01m8k$scd$4@news.misty.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27286&group=comp.os.vms#27286

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!.POSTED.80-218-16-84.dclient.hispeed.ch!not-for-mail
From: bqt...@softjar.se (Johnny Billquist)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Wed, 29 Mar 2023 17:42:12 +0200
Organization: MGT Consulting
Message-ID: <u01m8k$scd$4@news.misty.com>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com>
<4b19ca379d935295930f6fb5ea59f983d617f2bd.camel@munted.eu>
<tvulqg$3o71m$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 29 Mar 2023 15:42:12 -0000 (UTC)
Injection-Info: news.misty.com; posting-host="80-218-16-84.dclient.hispeed.ch:80.218.16.84";
logging-data="29069"; mail-complaints-to="abuse@misty.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.9.0
Content-Language: en-US
In-Reply-To: <tvulqg$3o71m$1@dont-email.me>
 by: Johnny Billquist - Wed, 29 Mar 2023 15:42 UTC

On 2023-03-28 14:16, Arne Vajhøj wrote:
> On 3/28/2023 4:06 AM, Single Stage to Orbit wrote:
>> On Tue, 2023-03-28 at 00:16 +0200, Johnny Billquist wrote:
>>> Actually, this one is worse. char is implementation defined if it is
>>> signed or not (really - the standard says so).
>>> If you think/assume they are signed, you're asking for it...
>>
>> Which is why stdint.h (or cstdint) was invented with explicit types
>> (uint8_t, uint64_t etc)
>
> They should be used.
>
> Just note that the spec says "These types are optional.", but
> I suspect that all the common platforms has them.

The thing is, char is very special. It is the only one that is
implementation defined if it is signed or unsigned. All the others
(short, int, long, long long) are by definition signed.

So this goes a little outside of stdint.h as well. It's just that char,
for whatever reason, is more weird/implementation specific than anything
else in C.

Johnny

Re: C limitations, was: Re: VMS process communication

<k8jc4aFmhtrU2@mid.individual.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27287&group=comp.os.vms#27287

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: bill.gun...@gmail.com (bill)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Wed, 29 Mar 2023 13:51:04 -0400
Lines: 31
Message-ID: <k8jc4aFmhtrU2@mid.individual.net>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com>
<4b19ca379d935295930f6fb5ea59f983d617f2bd.camel@munted.eu>
<tvulqg$3o71m$1@dont-email.me> <u01m8k$scd$4@news.misty.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net 28l6yHRrm9CD29vBGTGAOAibPtON7CHPJYGiHmq1LTs+snVNTC
Cancel-Lock: sha1:X9SLvM5cAxeHMZZb5VHXx1d4rhA=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.8.0
Content-Language: en-US
In-Reply-To: <u01m8k$scd$4@news.misty.com>
 by: bill - Wed, 29 Mar 2023 17:51 UTC

On 3/29/2023 11:42 AM, Johnny Billquist wrote:
> On 2023-03-28 14:16, Arne Vajhøj wrote:
>> On 3/28/2023 4:06 AM, Single Stage to Orbit wrote:
>>> On Tue, 2023-03-28 at 00:16 +0200, Johnny Billquist wrote:
>>>> Actually, this one is worse. char is implementation defined if it is
>>>> signed or not (really - the standard says so).
>>>> If you think/assume they are signed, you're asking for it...
>>>
>>> Which is why stdint.h (or cstdint) was invented with explicit types
>>> (uint8_t, uint64_t etc)
>>
>> They should be used.
>>
>> Just note that the spec says "These types are optional.", but
>> I suspect that all the common platforms has them.
>
> The thing is, char is very special. It is the only one that is
> implementation defined if it is signed or unsigned. All the others
> (short, int, long, long long) are by definition signed.
>
> So this goes a little outside of stdint.h as well. It's just that char,
> for whatever reason, is more weird/implementation specific than anything
> else in C.

Weird? What about under Primos where chars always have the high order
bit turned on? It was called "mark memory parity" but it never made any
sense to me when I had to work with it. :-)

bill

Re: C limitations, was: Re: VMS process communication

<u02h6t$gjre$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27288&group=comp.os.vms#27288

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Wed, 29 Mar 2023 19:22:03 -0400
Organization: A noiseless patient Spider
Lines: 202
Message-ID: <u02h6t$gjre$1@dont-email.me>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com> <tvt6ck$3dnj0$1@dont-email.me>
<u01m0b$scd$2@news.misty.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 29 Mar 2023 23:22:05 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="07da972998fd3774f8e1d492d5c660da";
logging-data="544622"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Hsp+kOz5/8gUHpQZ/f26Iviis9+R1Ny4="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:fFq0UEYJpbrK2YJXxOk5hT8H/Zg=
In-Reply-To: <u01m0b$scd$2@news.misty.com>
Content-Language: en-US
 by: Arne Vajhøj - Wed, 29 Mar 2023 23:22 UTC

On 3/29/2023 11:37 AM, Johnny Billquist wrote:
> On 2023-03-28 00:46, Arne Vajhøj wrote:
>> On 3/27/2023 6:16 PM, Johnny Billquist wrote:
>>> On 2023-03-27 14:27, Simon Clubley wrote:
>>>> enums are integers, not a type.
>>>
>>> Not sure I consider the enum thing to be much of a deal. Unless we
>>> compare to Ada, which is the only language I've seen which really do
>>> enums properly as its own type.
>>
>> Java enums are also very much non-int.
>
> I can't remember Java enough to be sure, but I don't think they went as
> far as Ada. What happens in Java if you print out the value of an enum
> variable? Can you loop over it, and that is a loop that does not have an
> integer loop counting? Can you read values into an enum, and do you then
> type in the possible enums or else get an error? Can you use enums as
> indexing in arrays? And nowhere does any numberness of the whole thing
> shines through?
>
> I thought Java was rather C-like...

Java use curly brackets, has the traditional if/switch/for/while/do
control structures and has char/short/int/long/float/double simple
data types.

But besides that it does not have that much in common with C.

Java enum's are not int's. But there are certain possibilities
to do stuff if one really wants to.

Let me explain.

First the very basic:

public enum Direction {
North, South, West, East;
}

This is not a type with integer values 0,1,2,3 or 1,2,3,4.

The Java compiler generate something similar to
(not quite like this - I will come back to that):

public final class Direction extends Enum {
public static final Direction North = new Direction();
public static final Direction South = new Direction();
public static final Direction West = new Direction();
public static final Direction East = new Direction();
private Direction() {
}
}

So the values of the enum are really references/pointers to
dynamically allocated objects. Either 32 or 64 bit. And may
actually have different values in different applications due to
different memory usage when initialized.

They are very type safe though. It is not possible to assign
between different unrelated classes.

But some convenience features was added:
* a toString method that convert to String representation
* a values method that return an array of ordered values
that can be iterated over
* a valueOf method that convert from String representation

$ type Nice.java
public class Nice {
public static void main(String[] args) {
Direction d0 = Direction.West;
System.out.println(d0);
for(Direction d1 : Direction.values()) {
System.out.println("-" + d1);
}
Direction d2 = Direction.valueOf("West");
System.out.println(d2);
}
} $ javac Nice.java
$ java "Nice"
West
-North
-South
-West
-East
West

That array of values can of course be abused to convert
to and from int.

$ type Hack.java
import java.util.Arrays;

public class Hack {
public static void main(String[] args) {
Direction[] alld = Direction.values();
int ix = Arrays.asList(alld).indexOf(Direction.West);
System.out.println(ix);
System.out.println(alld[ix]);
}
} $ javac Hack.java
$ java "Hack"
2 West

But I don't think that is really bad. That is all
array functionality and has nothing to do with enum.

But worse is that to support the convenience methods then
the private constructor is not:

private Direction() {
}

but instead:

private Direction(String strval, int ordval) {
super(strval, ordval);
}

which opens up for some creative abuse of the internals
of Enum.

$ type DirtyHack.java
import java.lang.reflect.Field;

public class DirtyHack {
public static void main(String[] args) throws NoSuchFieldException,
SecurityException, IllegalArgumentException, IllegalAccessEx
ception {
Direction d = Direction.West;
Field f = d.getClass().getSuperclass().getDeclaredField("ordinal");
f.setAccessible(true);
int ix = (int)(Integer)f.get(d);
System.out.println(ix);
System.out.println(Direction.values()[ix]);
}
} $ javac DirtyHack.java
$ java "DirtyHack"
2 West

Nobody use those hacks in practice, because Java's
enum has support for having extra properties
because it is a class under the hood.

$ type XDirection.java
public enum XDirection {
North(1001),
South(1002),
West(1003),
East(1004);
private int n;
private XDirection(int n) {
this.n = n;
}
public String toString() {
return String.format("%s (%d)", super.toString(), n);
}
public int getN() {
return n;
}
} $ javac "XDirection.java"
$ type Adv.java
public class Adv {
public static void main(String[] args) {
XDirection d0 = XDirection.West;
System.out.println(d0 + " : " + d0.getN());
for(XDirection d1 : XDirection.values()) {
System.out.println("-" + d1 + " : " + d1.getN());
}
XDirection d2 = XDirection.valueOf("West");
System.out.println(d2 + " : " + d2.getN());
}
} $ javac Adv.java
$ java "Adv"
West (1003) : 1003
-North (1001) : 1001
-South (1002) : 1002
-West (1003) : 1003
-East (1004) : 1004
West (1003) : 1003

I think that sort of explains Java enum.

One last thing - array indexes in Java are always int (signed
32 bit integer), so enums cannot be used as array index.

Arne

Re: C limitations, was: Re: VMS process communication

<u0d7ss$v7b$1@news.misty.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27299&group=comp.os.vms#27299

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!.POSTED.80-218-16-84.dclient.hispeed.ch!not-for-mail
From: bqt...@softjar.se (Johnny Billquist)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Mon, 3 Apr 2023 02:50:36 +0200
Organization: MGT Consulting
Message-ID: <u0d7ss$v7b$1@news.misty.com>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com>
<4b19ca379d935295930f6fb5ea59f983d617f2bd.camel@munted.eu>
<tvulqg$3o71m$1@dont-email.me> <u01m8k$scd$4@news.misty.com>
<k8jc4aFmhtrU2@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 3 Apr 2023 00:50:36 -0000 (UTC)
Injection-Info: news.misty.com; posting-host="80-218-16-84.dclient.hispeed.ch:80.218.16.84";
logging-data="31979"; mail-complaints-to="abuse@misty.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.9.1
Content-Language: en-US
In-Reply-To: <k8jc4aFmhtrU2@mid.individual.net>
 by: Johnny Billquist - Mon, 3 Apr 2023 00:50 UTC

On 2023-03-29 19:51, bill wrote:
> On 3/29/2023 11:42 AM, Johnny Billquist wrote:
>> On 2023-03-28 14:16, Arne Vajhøj wrote:
>>> On 3/28/2023 4:06 AM, Single Stage to Orbit wrote:
>>>> On Tue, 2023-03-28 at 00:16 +0200, Johnny Billquist wrote:
>>>>> Actually, this one is worse. char is implementation defined if it is
>>>>> signed or not (really - the standard says so).
>>>>> If you think/assume they are signed, you're asking for it...
>>>>
>>>> Which is why stdint.h (or cstdint) was invented with explicit types
>>>> (uint8_t, uint64_t etc)
>>>
>>> They should be used.
>>>
>>> Just note that the spec says "These types are optional.", but
>>> I suspect that all the common platforms has them.
>>
>> The thing is, char is very special. It is the only one that is
>> implementation defined if it is signed or unsigned. All the others
>> (short, int, long, long long) are by definition signed.
>>
>> So this goes a little outside of stdint.h as well. It's just that
>> char, for whatever reason, is more weird/implementation specific than
>> anything else in C.
>
> Weird?  What about under Primos where chars always have the high order
> bit turned on?  It was called "mark memory parity" but it never made any
> sense to me when I had to work with it.  :-)

I think/suspect that this goes outside the scope of C...

PDP-8, as well as very old PDP-11 software usually also used mark parity
on all characters. And as far as I know, the ASR-33 variant that DEC
used did this, which might be the reason for all software doing it.

Johnny

Re: C limitations, was: Re: VMS process communication

<k8vv8cFtencU2@mid.individual.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27302&group=comp.os.vms#27302

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: bill.gun...@gmail.com (bill)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Mon, 3 Apr 2023 08:31:07 -0400
Lines: 50
Message-ID: <k8vv8cFtencU2@mid.individual.net>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com>
<4b19ca379d935295930f6fb5ea59f983d617f2bd.camel@munted.eu>
<tvulqg$3o71m$1@dont-email.me> <u01m8k$scd$4@news.misty.com>
<k8jc4aFmhtrU2@mid.individual.net> <u0d7ss$v7b$1@news.misty.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net BAFDPUX/EyxRHbQYUB7MKQxsNKIFLOeGBqKkfKV6diGDefEae/
Cancel-Lock: sha1:qvBg8EHt9pQMccZjtIjpW4Ic1S0=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.8.0
Content-Language: en-US
In-Reply-To: <u0d7ss$v7b$1@news.misty.com>
 by: bill - Mon, 3 Apr 2023 12:31 UTC

On 4/2/2023 8:50 PM, Johnny Billquist wrote:
> On 2023-03-29 19:51, bill wrote:
>> On 3/29/2023 11:42 AM, Johnny Billquist wrote:
>>> On 2023-03-28 14:16, Arne Vajhøj wrote:
>>>> On 3/28/2023 4:06 AM, Single Stage to Orbit wrote:
>>>>> On Tue, 2023-03-28 at 00:16 +0200, Johnny Billquist wrote:
>>>>>> Actually, this one is worse. char is implementation defined if it is
>>>>>> signed or not (really - the standard says so).
>>>>>> If you think/assume they are signed, you're asking for it...
>>>>>
>>>>> Which is why stdint.h (or cstdint) was invented with explicit types
>>>>> (uint8_t, uint64_t etc)
>>>>
>>>> They should be used.
>>>>
>>>> Just note that the spec says "These types are optional.", but
>>>> I suspect that all the common platforms has them.
>>>
>>> The thing is, char is very special. It is the only one that is
>>> implementation defined if it is signed or unsigned. All the others
>>> (short, int, long, long long) are by definition signed.
>>>
>>> So this goes a little outside of stdint.h as well. It's just that
>>> char, for whatever reason, is more weird/implementation specific than
>>> anything else in C.
>>
>> Weird?  What about under Primos where chars always have the high order
>> bit turned on?  It was called "mark memory parity" but it never made any
>> sense to me when I had to work with it.  :-)
>
> I think/suspect that this goes outside the scope of C...

Of course it does. But it affects C a lot more than other languages
if for no other reason than programming style. How many Unix C programs
have you seen where parsing is done by looking at the value of a letter
as opposed to just comparing chars? Even with Primix porting a Unix
program to a Pr1me was a serious task and often not even possible.

>
> PDP-8, as well as very old PDP-11 software usually also used mark parity
> on all characters. And as far as I know, the ASR-33 variant that DEC
> used did this, which might be the reason for all software doing it.

I am not aware of any PDP-11 operating system where the charsets ASCII
values were 128 to 255 as opposed to 0 to 127. Certainly none where it
was the hardware forcing it.

bill

Re: C limitations, was: Re: VMS process communication

<u0q05f$f44$1@news.misty.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27376&group=comp.os.vms#27376

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!.POSTED.80-218-16-84.dclient.hispeed.ch!not-for-mail
From: bqt...@softjar.se (Johnny Billquist)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Fri, 7 Apr 2023 22:58:23 +0200
Organization: MGT Consulting
Message-ID: <u0q05f$f44$1@news.misty.com>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com>
<4b19ca379d935295930f6fb5ea59f983d617f2bd.camel@munted.eu>
<tvulqg$3o71m$1@dont-email.me> <u01m8k$scd$4@news.misty.com>
<k8jc4aFmhtrU2@mid.individual.net> <u0d7ss$v7b$1@news.misty.com>
<k8vv8cFtencU2@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 7 Apr 2023 20:58:24 -0000 (UTC)
Injection-Info: news.misty.com; posting-host="80-218-16-84.dclient.hispeed.ch:80.218.16.84";
logging-data="15492"; mail-complaints-to="abuse@misty.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.9.1
Content-Language: en-US
In-Reply-To: <k8vv8cFtencU2@mid.individual.net>
 by: Johnny Billquist - Fri, 7 Apr 2023 20:58 UTC

On 2023-04-03 14:31, bill wrote:
> On 4/2/2023 8:50 PM, Johnny Billquist wrote:
>> On 2023-03-29 19:51, bill wrote:
>>> On 3/29/2023 11:42 AM, Johnny Billquist wrote:
>>>> On 2023-03-28 14:16, Arne Vajhøj wrote:
>>>>> On 3/28/2023 4:06 AM, Single Stage to Orbit wrote:
>>>>>> On Tue, 2023-03-28 at 00:16 +0200, Johnny Billquist wrote:
>>>>>>> Actually, this one is worse. char is implementation defined if it is
>>>>>>> signed or not (really - the standard says so).
>>>>>>> If you think/assume they are signed, you're asking for it...
>>>>>>
>>>>>> Which is why stdint.h (or cstdint) was invented with explicit types
>>>>>> (uint8_t, uint64_t etc)
>>>>>
>>>>> They should be used.
>>>>>
>>>>> Just note that the spec says "These types are optional.", but
>>>>> I suspect that all the common platforms has them.
>>>>
>>>> The thing is, char is very special. It is the only one that is
>>>> implementation defined if it is signed or unsigned. All the others
>>>> (short, int, long, long long) are by definition signed.
>>>>
>>>> So this goes a little outside of stdint.h as well. It's just that
>>>> char, for whatever reason, is more weird/implementation specific
>>>> than anything else in C.
>>>
>>> Weird?  What about under Primos where chars always have the high order
>>> bit turned on?  It was called "mark memory parity" but it never made any
>>> sense to me when I had to work with it.  :-)
>>
>> I think/suspect that this goes outside the scope of C...
>
> Of course it does.  But it affects C a lot more than other languages
> if for no other reason than programming style.  How many Unix C programs
> have you seen where parsing is done by looking at the value of a letter
> as opposed to just comparing chars?  Even with Primix porting a Unix
> program to a Pr1me was a serious task and often not even possible.

I don't understand what you mean. Are you just talking about some people
assuming you have ASCII, and looking at the decimal values, instead of
the character representation. Basically writing 65 instead of 'A'?
If so, that is certainly something I've seen in lots of languages, and
are in fact much more an issue in most other languages that I've used,
since they do not consider a thing like 'A' to be a numeric value. C
doing that really helps in this context.

I'd say it's more common to see C code using the characters instead of
their numeric representation just because it is so easy to do in C.

>> PDP-8, as well as very old PDP-11 software usually also used mark
>> parity on all characters. And as far as I know, the ASR-33 variant
>> that DEC used did this, which might be the reason for all software
>> doing it.
>
> I am not aware of any PDP-11 operating system where the charsets ASCII
> values were 128 to 255 as opposed to 0 to 127.  Certainly none where it
> was the hardware forcing it.

XXDP (the PDP-11 diagnostics) are the oldest PDP-11 software I have been
dealing with. A lot of code in there assumes you are running with mark
parity, which basically means all output characters will always have the
high bit set.

Very annoying, but you just have to live with it, I guess. And most
PDP-8 software is older, and almost all of it assumes mark parity
everywhere. And I noticed when reading documentation and drawings on the
ASR33 that the ones DEC used unconditionally used mark parity as well.
So all data from the terminal have the high bit set as well. So it seems
to have been what DEC always used back then.

No, the hardware in the form of the serial lines themselves usually did
not force it, although I'm pretty sure some of them could be set to 7M1.
But hardware in the form of terminals certainly did.

Johnny

Re: C limitations, was: Re: VMS process communication

<u16fvo$32arb$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27470&group=comp.os.vms#27470

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Wed, 12 Apr 2023 10:41:58 -0400
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <u16fvo$32arb$1@dont-email.me>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com>
<4b19ca379d935295930f6fb5ea59f983d617f2bd.camel@munted.eu>
<tvulqg$3o71m$1@dont-email.me> <u01m8k$scd$4@news.misty.com>
<k8jc4aFmhtrU2@mid.individual.net> <u0d7ss$v7b$1@news.misty.com>
<k8vv8cFtencU2@mid.individual.net> <u0q05f$f44$1@news.misty.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 12 Apr 2023 14:42:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2e46a29c055a71dbd12198dd43d3433f";
logging-data="3222379"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19CIlWyM9Ni036croAcy0/3aA4SMLaD1yU="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.9.1
Cancel-Lock: sha1:wu2nthQjC01PrnvEv5pu4vmpizY=
Content-Language: en-US
In-Reply-To: <u0q05f$f44$1@news.misty.com>
 by: Arne Vajhøj - Wed, 12 Apr 2023 14:41 UTC

On 4/7/2023 4:58 PM, Johnny Billquist wrote:
> On 2023-04-03 14:31, bill wrote:
>> On 4/2/2023 8:50 PM, Johnny Billquist wrote:
>>> On 2023-03-29 19:51, bill wrote:
>>>> Weird?  What about under Primos where chars always have the high order
>>>> bit turned on?  It was called "mark memory parity" but it never made
>>>> any
>>>> sense to me when I had to work with it.  :-)
>>>
>>> I think/suspect that this goes outside the scope of C...
>>
>> Of course it does.  But it affects C a lot more than other languages
>> if for no other reason than programming style.  How many Unix C programs
>> have you seen where parsing is done by looking at the value of a letter
>> as opposed to just comparing chars?  Even with Primix porting a Unix
>> program to a Pr1me was a serious task and often not even possible.
>
> I don't understand what you mean. Are you just talking about some people
> assuming you have ASCII, and looking at the decimal values, instead of
> the character representation. Basically writing 65 instead of 'A'?
> If so, that is certainly something I've seen in lots of languages, and
> are in fact much more an issue in most other languages that I've used,
> since they do not consider a thing like 'A' to be a numeric value. C
> doing that really helps in this context.
>
> I'd say it's more common to see C code using the characters instead of
> their numeric representation just because it is so easy to do in C.

I believe there are basically two groups of languages:

A) those where one can write both c=='A' and c==65
B) those where one can write c=='A' but c==65 gives a compile error and
has to be written as ord(c)==65

I find it more likely that group A will use 65 than group B.

Arne

Re: C limitations, was: Re: VMS process communication

<u16g44$32arb$2@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27471&group=comp.os.vms#27471

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Wed, 12 Apr 2023 10:44:19 -0400
Organization: A noiseless patient Spider
Lines: 448
Message-ID: <u16g44$32arb$2@dont-email.me>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com>
<4b19ca379d935295930f6fb5ea59f983d617f2bd.camel@munted.eu>
<tvulqg$3o71m$1@dont-email.me> <u01m8k$scd$4@news.misty.com>
<k8jc4aFmhtrU2@mid.individual.net> <u0d7ss$v7b$1@news.misty.com>
<k8vv8cFtencU2@mid.individual.net> <u0q05f$f44$1@news.misty.com>
<u16fvo$32arb$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 12 Apr 2023 14:44:21 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2e46a29c055a71dbd12198dd43d3433f";
logging-data="3222379"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+W7CY26O6gcRbUHqIJspCmaTtRrjhtGs8="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.9.1
Cancel-Lock: sha1:R1eSw5muwXvylmaBfJpLjL54wn0=
In-Reply-To: <u16fvo$32arb$1@dont-email.me>
Content-Language: en-US
 by: Arne Vajhøj - Wed, 12 Apr 2023 14:44 UTC

On 4/12/2023 10:41 AM, Arne Vajhøj wrote:
> On 4/7/2023 4:58 PM, Johnny Billquist wrote:
>> On 2023-04-03 14:31, bill wrote:
>>> On 4/2/2023 8:50 PM, Johnny Billquist wrote:
>>>> On 2023-03-29 19:51, bill wrote:
>>>>> Weird?  What about under Primos where chars always have the high order
>>>>> bit turned on?  It was called "mark memory parity" but it never
>>>>> made any
>>>>> sense to me when I had to work with it.  :-)
>>>>
>>>> I think/suspect that this goes outside the scope of C...
>>>
>>> Of course it does.  But it affects C a lot more than other languages
>>> if for no other reason than programming style.  How many Unix C programs
>>> have you seen where parsing is done by looking at the value of a letter
>>> as opposed to just comparing chars?  Even with Primix porting a Unix
>>> program to a Pr1me was a serious task and often not even possible.
>>
>> I don't understand what you mean. Are you just talking about some
>> people assuming you have ASCII, and looking at the decimal values,
>> instead of the character representation. Basically writing 65 instead
>> of 'A'?
>> If so, that is certainly something I've seen in lots of languages, and
>> are in fact much more an issue in most other languages that I've used,
>> since they do not consider a thing like 'A' to be a numeric value. C
>> doing that really helps in this context.
>>
>> I'd say it's more common to see C code using the characters instead of
>> their numeric representation just because it is so easy to do in C.
>
> I believe there are basically two groups of languages:
>
> A) those where one can write both c=='A' and c==65
> B) those where one can write c=='A' but c==65 gives a compile error and
> has to be written as ord(c)==65
>
> I find it more likely that group A will use 65 than group B.

Examples of code:

$ type isint.c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

static int isint(const char *s)
{ int res, i;
if((s == NULL) || (strlen(s) == 0))
{
res = FALSE;
}
else
{
res = TRUE;
for(i = 0; i < strlen(s); i++)
{
if((s[i] < '0') || ('9' < s[i]))
{
if((i != 0) || (s[i] != '-'))
{
res = FALSE;
}
}
}
}
return res;
}

static int isintx(const char *s)
{ int res, i;
if((s == NULL) || (strlen(s) == 0))
{
res = FALSE;
}
else
{
res = TRUE;
for(i = 0; i < strlen(s); i++)
{
if((s[i] < 48) || (57 < s[i]))
{
if((i != 0) || (s[i] != 45))
{
res = FALSE;
}
}
}
}
return res;
}

static void test(const char *s)
{ printf("\"%s\" : %d\n", s, isint(s));
printf("\"%s\" : %d\n", s, isintx(s));
}

int main(int argc, char *argv[])
{ test("123");
test("-123");
test("ABC");
test("123X");
test("");
return 0;
} $ cc isint
$ link isint
$ run isint
"123" : 1
"123" : 1
"-123" : 1
"-123" : 1
"ABC" : 0
"ABC" : 0
"123X" : 0
"123X" : 0
"" : 0
"" : 0
$ type isint.pas
program main(input,output);

type
pstr = varying [255] of char;

function isint(s : pstr) : boolean;

var
i : integer;
res : boolean;

begin
if length(s) = 0 then begin
res := false;
end else begin
res := true;
for i:= 1 to length(s) do begin
if (s[i] < '0') or ('9' < s[i]) then begin
if (i <> 1) or (s[i] <> '-') then begin
res := false;
end;
end;
end;
end;
isint := res;
end;

function isintx(s : pstr) : boolean;

var
i : integer;
res : boolean;

begin
if length(s) = 0 then begin
res := false;
end else begin
res := true;
for i:= 1 to length(s) do begin
if (ord(s[i]) < 48) or (57 < ord(s[i])) then begin
if (i <> 1) or (ord(s[i]) <> 45) then begin
res := false;
end;
end;
end;
end;
isintx := res;
end;

procedure test(s : pstr);

begin
writeln('"', s, '" : ', isint(s):1);
writeln('"', s, '" : ', isintx(s):1);
end;

begin
test('123');
test('-123');
test('ABC');
test('123X');
test('');
end.
$ pas isint
$ link isint
$ run isint
"123" : T
"123" : T
"-123" : T
"-123" : T
"ABC" : F
"ABC" : F
"123X" : F
"123X" : F
"" : F
"" : F
$ type isint.for
program main
call test('123')
call test('-123')
call test('ABC')
call test('123X')
call test('')
end
c subroutine test(s)
character*(*) s
logical*4 isint
logical*4 isintx
write(6,'(1x,1h",a,1h",3h : ,l1)') s,isint(s)
write(6,'(1x,1h",a,1h",3h : ,l1)') s,isintx(s)
return
end
c logical*4 function isint(s)
character*(*) s
integer*4 i
logical*4 res
if(len(s).eq.0) then
res = .false.
else
res = .true.
do 100 i = 1,len(s)
if((s(i:i).lt.'0').or.('9'.lt.s(i:i))) then
if((i.ne.1).or.(s(i:i).ne.'-')) then
res = .false.
end if
end if
100 continue
end if
isint = res
return
end
c logical*4 function isintx(s)
character*(*) s
integer*4 i
logical*4 res
if(len(s).eq.0) then
res = .false.
else
res = .true.
do 100 i = 1,len(s)
if((ichar(s(i:i)).lt.48).or.(57.lt.ichar(s(i:i)))) then
if((i.ne.1).or.(ichar(s(i:i)).ne.45)) then
res = .false.
end if
end if
100 continue
end if
isintx = res
return
end
$ for isint
$ link isint
$ run isint
"123" : T
"123" : T
"-123" : T
"-123" : T
"ABC" : F
"ABC" : F
"123X" : F
"123X" : F
"" : F
"" : F
$ type isint.bas
program main

external sub test(string)

call test("123")
call test("-123")
call test("ABC")
call test("123X")
call test("")

end program
! sub test(string s)

external integer function isint(string)
external integer function isintx(string)

print using '"' + s + '"' + " : ##", isint(s)
print using '"' + s + '"' + " : ##", isintx(s)

end sub
! function integer isint(string s)

declare integer i, res

if len(s) = 0 then
res = 0
else
res = -1
for i = 1 to len(s)
if (mid$(s, i, 1) < "1") or ("9" < mid$(s, i, 1)) then
if (i <> 1) or (mid$(s, i, 1) <> "-") then
res = 0
end if
end if
next i
end if
isint = res

end function
! function integer isintx(string s)

declare integer i, res

if len(s) = 0 then
res = 0
else
res = -1
for i = 1 to len(s)
if (asc(mid$(s, i, 1)) < 48) or (57 < asc(mid$(s, i, 1))) then
if (i <> 1) or (asc(mid$(s, i, 1)) <> 45) then
res = 0
end if
end if
next i
end if
isintx = res

end function
$ bas isint
$ link isint
$ run isint
"123" : -1
"123" : -1
"-123" : -1
"-123" : -1
"ABC" : 0
"ABC" : 0
"123X" : 0
"123X" : 0
"" : 0
"" : 0
$ type IsInt.java
public class IsInt {
private static boolean isInt(String s) {
boolean res;
if((s == null) || (s.length() == 0)) {
res = false;
} else {
res = true;
for(int i = 0; i < s.length(); i++) {
if((s.charAt(i) < '0') || ('9' < s.charAt(i))) {
if((i != 0) || (s.charAt(i) != '-')) {
res = false;
}
}
}
}
return res;
}
private static boolean isIntX(String s) {
boolean res;
if((s == null) || (s.length() == 0)) {
res = false;
} else {
res = true;
for(int i = 0; i < s.length(); i++) {
if((s.charAt(i) < 48) || (57 < s.charAt(i))) {
if((i != 0) || (s.charAt(i) != 45)) {
res = false;
}
}
}
}
return res;
}
private static void test(String s) {
System.out.printf("\"%s\" : %b\n", s, isInt(s));
System.out.printf("\"%s\" : %b\n", s, isIntX(s));
}
public static void main(String[] args) throws Exception {
test("123");
test("-123");
test("ABC");
test("123X");
test("");
}
}
Click here to read the complete article

Re: C limitations, was: Re: VMS process communication

<kcGdndatdIiwtar5nZ2dnZfqn_ednZ2d@giganews.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27481&group=comp.os.vms#27481

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.uzoreto.com!peer01.ams4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!69.80.99.23.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 12 Apr 2023 21:52:45 +0000
Sender: Dennis Boone <drb@yagi.h-net.org>
From: drb...@ihatespam.msu.edu (Dennis Boone)
Subject: Re: C limitations, was: Re: VMS process communication
Newsgroups: comp.os.vms
References: <631fb9a1$0$703$14726298@news.sunsite.dk> <tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net> <tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me> <tvt4jf$b82$1@news.misty.com> <4b19ca379d935295930f6fb5ea59f983d617f2bd.camel@munted.eu> <tvulqg$3o71m$1@dont-email.me> <u01m8k$scd$4@news.misty.com> <k8jc4aFmhtrU2@mid.individual.net> <u0d7ss$v7b$1@news.misty.com> <k8vv8cFtencU2@mid.individual.net> <u0q05f$f44$1@news.misty.com> <k9o4ddF9sbsU3@mid.individual.net>
User-Agent: tin/2.6.1-20211226 ("Convalmore") (FreeBSD/13.1-RELEASE-p2 (amd64))
Message-ID: <kcGdndatdIiwtar5nZ2dnZfqn_ednZ2d@giganews.com>
Date: Wed, 12 Apr 2023 21:52:45 +0000
Lines: 25
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-LrWCbuvicGWf6cvTDoTyGx5c+8PkL9Vag1ulZaWKiANpAt+vIwL282WUztQm36yoxvv5XUhjrXATRQ4!1qOe4/zuDxI/EGCfrIheKObRvuSLcVPRFnuLsXMf58zqGOeJdRbw2TcK2DLUparrbLU3ovI=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Received-Bytes: 2810
 by: Dennis Boone - Wed, 12 Apr 2023 21:52 UTC

> But that is only during communications. I am not aware of any program
> that computed the value of a character in transit and cared what that
> value was. Pr1me set the values in their firmware forcing all programs
> in any language to deal with an ASCII set that had values from 128 to
> 255. If they had survived , I wonder what they would have done when
> 8bit ASCII came about?

Why, used the 'space parity' moby, of course.

https://sysovl.info/reference_prime_drb_ecs.html

It's ISO-8859-1 turned upside down.

> And the truly sad part is probably that there really was no reason for
> it. When Bill Lenhart was working on native mode Unix for the Pr1me
> 50-series he "fixed" it in the microcode. Sadly, Pr1me pulled the plug
> on his work just before he was going to release it.

The reason is alternately given as "compatibility with the CCC/Honeywell
family", "because the teletypes typically ran that way", etc. But the
reason it never got changed has to be because the second motto of Prime:
"And COMPATIBILITY shall Rule Forever". (With apologies to Mosley
Meer.)

De

Re: C limitations, was: Re: VMS process communication

<k9o4ddF9sbsU3@mid.individual.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27484&group=comp.os.vms#27484

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!news.mb-net.net!open-news-network.org!news.mind.de!bolzen.all.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: bill.gun...@gmail.com (bill)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Wed, 12 Apr 2023 12:26:21 -0400
Lines: 108
Message-ID: <k9o4ddF9sbsU3@mid.individual.net>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com>
<4b19ca379d935295930f6fb5ea59f983d617f2bd.camel@munted.eu>
<tvulqg$3o71m$1@dont-email.me> <u01m8k$scd$4@news.misty.com>
<k8jc4aFmhtrU2@mid.individual.net> <u0d7ss$v7b$1@news.misty.com>
<k8vv8cFtencU2@mid.individual.net> <u0q05f$f44$1@news.misty.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net g8xlNweZeEG+7+DlubRZKQ2x4g1SYbTPu2Xyvpv1s25sskrWKH
Cancel-Lock: sha1:99pLU8Qbeh7YV/sE9FS9AfSkedo=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.9.1
Content-Language: en-US
In-Reply-To: <u0q05f$f44$1@news.misty.com>
 by: bill - Wed, 12 Apr 2023 16:26 UTC

On 4/7/2023 4:58 PM, Johnny Billquist wrote:
> On 2023-04-03 14:31, bill wrote:
>> On 4/2/2023 8:50 PM, Johnny Billquist wrote:
>>> On 2023-03-29 19:51, bill wrote:
>>>> On 3/29/2023 11:42 AM, Johnny Billquist wrote:
>>>>> On 2023-03-28 14:16, Arne Vajhøj wrote:
>>>>>> On 3/28/2023 4:06 AM, Single Stage to Orbit wrote:
>>>>>>> On Tue, 2023-03-28 at 00:16 +0200, Johnny Billquist wrote:
>>>>>>>> Actually, this one is worse. char is implementation defined if
>>>>>>>> it is
>>>>>>>> signed or not (really - the standard says so).
>>>>>>>> If you think/assume they are signed, you're asking for it...
>>>>>>>
>>>>>>> Which is why stdint.h (or cstdint) was invented with explicit types
>>>>>>> (uint8_t, uint64_t etc)
>>>>>>
>>>>>> They should be used.
>>>>>>
>>>>>> Just note that the spec says "These types are optional.", but
>>>>>> I suspect that all the common platforms has them.
>>>>>
>>>>> The thing is, char is very special. It is the only one that is
>>>>> implementation defined if it is signed or unsigned. All the others
>>>>> (short, int, long, long long) are by definition signed.
>>>>>
>>>>> So this goes a little outside of stdint.h as well. It's just that
>>>>> char, for whatever reason, is more weird/implementation specific
>>>>> than anything else in C.
>>>>
>>>> Weird?  What about under Primos where chars always have the high order
>>>> bit turned on?  It was called "mark memory parity" but it never made
>>>> any
>>>> sense to me when I had to work with it.  :-)
>>>
>>> I think/suspect that this goes outside the scope of C...
>>
>> Of course it does.  But it affects C a lot more than other languages
>> if for no other reason than programming style.  How many Unix C programs
>> have you seen where parsing is done by looking at the value of a letter
>> as opposed to just comparing chars?  Even with Primix porting a Unix
>> program to a Pr1me was a serious task and often not even possible.
>
> I don't understand what you mean. Are you just talking about some people
> assuming you have ASCII, and looking at the decimal values, instead of
> the character representation. Basically writing 65 instead of 'A'?
> If so, that is certainly something I've seen in lots of languages, and
> are in fact much more an issue in most other languages that I've used,
> since they do not consider a thing like 'A' to be a numeric value. C
> doing that really helps in this context.

Yes, other languages had people doing this, too. But, at the time of
Primos and Primix there weren't a lot of people writing code intended
to be portable in those other languages. Most of the comp.sources.xxx
entries were C and Unix based.

>
> I'd say it's more common to see C code using the characters instead of
> their numeric representation just because it is so easy to do in C.

I saw a number of programs with parsers that relied on the value of
ASCII being between 0 and 127. That was never the case with Pr1me.
Not even under Primix.

>
>>> PDP-8, as well as very old PDP-11 software usually also used mark
>>> parity on all characters. And as far as I know, the ASR-33 variant
>>> that DEC used did this, which might be the reason for all software
>>> doing it.
>>
>> I am not aware of any PDP-11 operating system where the charsets ASCII
>> values were 128 to 255 as opposed to 0 to 127.  Certainly none where it
>> was the hardware forcing it.
>
> XXDP (the PDP-11 diagnostics) are the oldest PDP-11 software I have been
> dealing with. A lot of code in there assumes you are running with mark
> parity, which basically means all output characters will always have the
> high bit set.

Yes, but there is a big difference between communications parity and
memory parity.

>
> Very annoying, but you just have to live with it, I guess. And most
> PDP-8 software is older, and almost all of it assumes mark parity
> everywhere. And I noticed when reading documentation and drawings on the
> ASR33 that the ones DEC used unconditionally used mark parity as well.
> So all data from the terminal have the high bit set as well. So it seems
> to have been what DEC always used back then.
>
> No, the hardware in the form of the serial lines themselves usually did
> not force it, although I'm pretty sure some of them could be set to 7M1.
> But hardware in the form of terminals certainly did.

But that is only during communications. I am not aware of any program
that computed the value of a character in transit and cared what that
value was. Pr1me set the values in their firmware forcing all programs
in any language to deal with an ASCII set that had values from 128 to
255. If they had survived , I wonder what they would have done when
8bit ASCII came about?

And the truly sad part is probably that there really was no reason for
it. When Bill Lenhart was working on native mode Unix for the Pr1me
50-series he "fixed" it in the microcode. Sadly, Pr1me pulled the plug
on his work just before he was going to release it.

bill

Re: C limitations, was: Re: VMS process communication

<u17m5s$etu$1@news.misty.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27486&group=comp.os.vms#27486

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!.POSTED.80-218-16-84.dclient.hispeed.ch!not-for-mail
From: bqt...@softjar.se (Johnny Billquist)
Newsgroups: comp.os.vms
Subject: Re: C limitations, was: Re: VMS process communication
Date: Thu, 13 Apr 2023 03:33:48 +0200
Organization: MGT Consulting
Message-ID: <u17m5s$etu$1@news.misty.com>
References: <631fb9a1$0$703$14726298@news.sunsite.dk>
<tvf4j6$lpst$1@dont-email.me> <k88rd6FmhttU1@mid.individual.net>
<tvnffo$shi$1@panix2.panix.com> <tvs23c$37d4e$1@dont-email.me>
<tvt4jf$b82$1@news.misty.com>
<4b19ca379d935295930f6fb5ea59f983d617f2bd.camel@munted.eu>
<tvulqg$3o71m$1@dont-email.me> <u01m8k$scd$4@news.misty.com>
<k8jc4aFmhtrU2@mid.individual.net> <u0d7ss$v7b$1@news.misty.com>
<k8vv8cFtencU2@mid.individual.net> <u0q05f$f44$1@news.misty.com>
<u16fvo$32arb$1@dont-email.me> <u16g44$32arb$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 13 Apr 2023 01:33:48 -0000 (UTC)
Injection-Info: news.misty.com; posting-host="80-218-16-84.dclient.hispeed.ch:80.218.16.84";
logging-data="15294"; mail-complaints-to="abuse@misty.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.9.1
Content-Language: en-US
In-Reply-To: <u16g44$32arb$2@dont-email.me>
 by: Johnny Billquist - Thu, 13 Apr 2023 01:33 UTC

On 2023-04-12 16:44, Arne Vajhøj wrote:
> On 4/12/2023 10:41 AM, Arne Vajhøj wrote:
>> On 4/7/2023 4:58 PM, Johnny Billquist wrote:
>>> On 2023-04-03 14:31, bill wrote:
>>>> On 4/2/2023 8:50 PM, Johnny Billquist wrote:
>>>>> On 2023-03-29 19:51, bill wrote:
>>>>>> Weird?  What about under Primos where chars always have the high
>>>>>> order
>>>>>> bit turned on?  It was called "mark memory parity" but it never
>>>>>> made any
>>>>>> sense to me when I had to work with it.  :-)
>>>>>
>>>>> I think/suspect that this goes outside the scope of C...
>>>>
>>>> Of course it does.  But it affects C a lot more than other languages
>>>> if for no other reason than programming style.  How many Unix C
>>>> programs
>>>> have you seen where parsing is done by looking at the value of a letter
>>>> as opposed to just comparing chars?  Even with Primix porting a Unix
>>>> program to a Pr1me was a serious task and often not even possible.
>>>
>>> I don't understand what you mean. Are you just talking about some
>>> people assuming you have ASCII, and looking at the decimal values,
>>> instead of the character representation. Basically writing 65 instead
>>> of 'A'?
>>> If so, that is certainly something I've seen in lots of languages,
>>> and are in fact much more an issue in most other languages that I've
>>> used, since they do not consider a thing like 'A' to be a numeric
>>> value. C doing that really helps in this context.
>>>
>>> I'd say it's more common to see C code using the characters instead
>>> of their numeric representation just because it is so easy to do in C.
>>
>> I believe there are basically two groups of languages:
>>
>> A) those where one can write both c=='A' and c==65
>> B) those where one can write c=='A' but c==65 gives a compile error
>> and has to be written as ord(c)==65
>>
>> I find it more likely that group A will use 65 than group B.
>
> Examples of code:

[...lots of code deleted...]

The problem with this is that it is very artificial, and designed to
prove your point.

I can just as well give a counter example.

Let's say you have a character that you know is a digit, and you want to
convert it nicely to an integer.

In C, you'd do that like this:

x = c - '0';

In FORTRAN, BASIC, and god knows what else, you'd see:

x = ord(c) - 48;

Now, I'd say I've seen plenty more of that than your type of example.
And I've *never* seen:

x = ord(c) - ord('0');

And yes, of course, you can also in C do:

x = c - 48;

but I'd say that is less common, and a bad programmer will always manage
to write bad code, no matter what language. That don't mean the language
is bad. It is just more unclear, and in C there is no performance
reason, or anything else giving any reason why you would write 48, when
'0' is so much clearer what the intent is. And then it also works if you
use another character set, as long as all the digits have consecutive
code points.

Johnny

Pages:123456789
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor