Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

1 1 was a race-horse, 2 2 was 1 2. When 1 1 1 1 race, 2 2 1 1 2.


devel / comp.lang.c / Why does the -> operator exist ?

SubjectAuthor
* Why does the -> operator exist ?Spiros Bousbouras
+* Re: Why does the -> operator exist ?Felix Palmen
|`* Re: Why does the -> operator exist ?Spiros Bousbouras
| `- Re: Why does the -> operator exist ?Ben Bacarisse
+* Re: Why does the -> operator exist ?Bart
|+* Re: Why does the -> operator exist ?Ben Bacarisse
||`- Re: Why does the -> operator exist ?BGB
|`* Re: Why does the -> operator exist ?fir
| `* Re: Why does the -> operator exist ?fir
|  `- Re: Why does the -> operator exist ?fir
+- Re: Why does the -> operator exist ?Lew Pitcher
+* Re: Why does the -> operator exist ?Kaz Kylheku
|`* Re: Why does the -> operator exist ?Bart
| `- Re: Why does the -> operator exist ?Kaz Kylheku
+- Re: Why does the -> operator exist ?BGB
+* Re: Why does the -> operator exist ?Keith Thompson
|+- Re: Why does the -> operator exist ?Joe Pfeiffer
|+* Re: Why does the -> operator exist ?Spiros Bousbouras
||`- Re: Why does the -> operator exist ?Kaz Kylheku
|`* Re: Why does the -> operator exist ?Tim Rentsch
| +* Re: Why does the -> operator exist ?Keith Thompson
| |`* Re: Why does the -> operator exist ?Tim Rentsch
| | `* Re: Why does the -> operator exist ?Keith Thompson
| |  `* Re: Why does the -> operator exist ?Tim Rentsch
| |   +- I love it... (Was: Why does the -> operator exist ?)Kenny McCormack
| |   `* Re: Why does the -> operator exist ?Keith Thompson
| |    +- Re: Why does the -> operator exist ?Phil Carmody
| |    `- Re: Why does the -> operator exist ?Tim Rentsch
| `- Re: Why does the -> operator exist ?Kaz Kylheku
`- Re: Why does the -> operator exist ?Andrey Tarasevich

Pages:12
Why does the -> operator exist ?

<trfLpf+N71iCzEwJm@bongo-ra.co>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!paganini.bofh.team!not-for-mail
From: spi...@gmail.com (Spiros Bousbouras)
Newsgroups: comp.lang.c
Subject: Why does the -> operator exist ?
Date: Tue, 27 Jun 2023 09:12:09 -0000 (UTC)
Organization: To protect and to server
Message-ID: <trfLpf+N71iCzEwJm@bongo-ra.co>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 27 Jun 2023 09:12:09 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="3236498"; posting-host="9H7U5kayiTdk7VIdYU44Rw.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team"; posting-account="9dIQLXBM7WM9KzA+yjdR4A";
Cancel-Lock: sha256:pezf/+gbdKtuWUCdH6M0qZScnHKMBdj6ETqYLxUoLuA=
X-Notice: Filtered by postfilter v. 0.9.3
X-Organisation: Weyland-Yutani
X-Server-Commands: nowebcancel
 by: Spiros Bousbouras - Tue, 27 Jun 2023 09:12 UTC

I mean would it create an ambiguity if you could write s.field
both when s is a structure or union and when s is a pointer
to a structure or union ?

Re: Why does the -> operator exist ?

<s53rmj-dhr1.ln1@mail.home.palmen-it.de>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: fel...@palmen-it.de (Felix Palmen)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Tue, 27 Jun 2023 15:01:16 +0200
Organization: palmen-it.de
Lines: 24
Message-ID: <s53rmj-dhr1.ln1@mail.home.palmen-it.de>
References: <trfLpf+N71iCzEwJm@bongo-ra.co>
Injection-Date: Tue, 27 Jun 2023 15:01:16 +0200
Injection-Info: dont-email.me; posting-host="3596b61b313dec7539ec7df34578d66c";
logging-data="1484079"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QINAtjEPeWm/1md9nq+IF"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (FreeBSD/13.2-RELEASE (amd64)) tinews.pl/1.1.61
Cancel-Lock: sha256:TTLpkvMWGFECok2tEPTTEGiyygsah30wNQhsGJpegq8=
sha1:R4TlSomoo3rW4HGmXAMtN+Twww8=
X-PGP-Key: 693613D55BBF4837B2123ACC54ADE0069879F231
X-PGP-Sig: GnuPG-v2 From,Newsgroups,Subject,Date,Injection-Date,Message-ID
iNUEARYIAH0WIQRpNhPVW79IN7ISOsxUreAGmHnyMQUCZJrdnl8UgAAAAAAuAChp
c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0Njkz
NjEzRDU1QkJGNDgzN0IyMTIzQUNDNTRBREUwMDY5ODc5RjIzMQAKCRBUreAGmHny
MdzeAP9C/UvA3OWr3QoH9G3adWbpoLw/NGg+Dvv7rjGNDxnCwwEA8vb99+y5V+pD
x59ls4xHrRJygW8IaBCwycQzogqxHAA=
=NtB0
X-PGP-Hash: SHA256
 by: Felix Palmen - Tue, 27 Jun 2023 13:01 UTC

* Spiros Bousbouras <spibou@gmail.com>:
> I mean would it create an ambiguity if you could write s.field
> both when s is a structure or union and when s is a pointer
> to a structure or union ?

Most likely no.

So, my answer will be an opinion: In a language like C (with explicit
resource management), pointers (taking them, dereferencing them) really
*should* be explicit. For correct code, it's important to know whether
you're dealing with a pointer or not. And the compiler gets a chance to
tell you "careful, this doesn't have the type you seemed to expect".

Yes, I know there are already a few exceptions. But looking at function
pointers, they are special anyways, as functions themselves don't exist
as types. And looking at the special evaluation of an array identifier
as a pointer to its first element, well, this really created more than
enough confusion, especially among beginners.

--
Dipl.-Inform. Felix Palmen <felix@palmen-it.de> ,.//..........
{web} http://palmen-it.de {jabber} [see email] ,//palmen-it.de
{pgp public key} http://palmen-it.de/pub.txt // """""""""""
{pgp fingerprint} 6936 13D5 5BBF 4837 B212 3ACC 54AD E006 9879 F231

Re: Why does the -> operator exist ?

<5GG1hY+aCvnXx5w2K@bongo-ra.co>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spi...@gmail.com (Spiros Bousbouras)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Tue, 27 Jun 2023 14:09:31 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <5GG1hY+aCvnXx5w2K@bongo-ra.co>
References: <trfLpf+N71iCzEwJm@bongo-ra.co> <s53rmj-dhr1.ln1@mail.home.palmen-it.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 27 Jun 2023 14:09:31 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e2c2b5ca55ecdc89452d4f4119bfae7d";
logging-data="1497754"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19SEfi39o/F8hUv0sIngmG5"
Cancel-Lock: sha1:Hj/P0vgyvpQinwwJCFFv11d0ja0=
X-Server-Commands: nowebcancel
In-Reply-To: <s53rmj-dhr1.ln1@mail.home.palmen-it.de>
X-Organisation: Weyland-Yutani
 by: Spiros Bousbouras - Tue, 27 Jun 2023 14:09 UTC

On Tue, 27 Jun 2023 15:01:16 +0200
felix@palmen-it.de (Felix Palmen) wrote:
> * Spiros Bousbouras <spibou@gmail.com>:
> > I mean would it create an ambiguity if you could write s.field
> > both when s is a structure or union and when s is a pointer
> > to a structure or union ?
>
> Most likely no.
>
> So, my answer will be an opinion: In a language like C (with explicit
> resource management), pointers (taking them, dereferencing them) really
> *should* be explicit. For correct code, it's important to know whether
> you're dealing with a pointer or not. And the compiler gets a chance to
> tell you "careful, this doesn't have the type you seemed to expect".
>
> Yes, I know there are already a few exceptions. But looking at function
> pointers, they are special anyways, as functions themselves don't exist
> as types. And looking at the special evaluation of an array identifier
> as a pointer to its first element, well, this really created more than
> enough confusion, especially among beginners.

A more similar exception is an expression a + b where b is an integer
type. a can be a pointer or an arithmetic type.

Re: Why does the -> operator exist ?

<87fs6dosx5.fsf@bsb.me.uk>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Tue, 27 Jun 2023 15:56:22 +0100
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <87fs6dosx5.fsf@bsb.me.uk>
References: <trfLpf+N71iCzEwJm@bongo-ra.co>
<s53rmj-dhr1.ln1@mail.home.palmen-it.de>
<5GG1hY+aCvnXx5w2K@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="42bc170245e1698a7bd97066840a5ff2";
logging-data="1506343"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+YY3qaJ84jhePHShXd9XRLDJvZ53vKmFo="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:sfeWImElsaRyuQUOZkxOeeh44d8=
sha1:ko1deNXLd4AkNVRXuC3R0gQO+JI=
X-BSB-Auth: 1.c205fba14fb4a1fa5b05.20230627155622BST.87fs6dosx5.fsf@bsb.me.uk
 by: Ben Bacarisse - Tue, 27 Jun 2023 14:56 UTC

Spiros Bousbouras <spibou@gmail.com> writes:

> On Tue, 27 Jun 2023 15:01:16 +0200
> felix@palmen-it.de (Felix Palmen) wrote:
>> * Spiros Bousbouras <spibou@gmail.com>:
>> > I mean would it create an ambiguity if you could write s.field
>> > both when s is a structure or union and when s is a pointer
>> > to a structure or union ?
>>
>> Most likely no.
>>
>> So, my answer will be an opinion: In a language like C (with explicit
>> resource management), pointers (taking them, dereferencing them) really
>> *should* be explicit. For correct code, it's important to know whether
>> you're dealing with a pointer or not. And the compiler gets a chance to
>> tell you "careful, this doesn't have the type you seemed to expect".
>>
>> Yes, I know there are already a few exceptions. But looking at function
>> pointers, they are special anyways, as functions themselves don't exist
>> as types. And looking at the special evaluation of an array identifier
>> as a pointer to its first element, well, this really created more than
>> enough confusion, especially among beginners.
>
> A more similar exception is an expression a + b where b is an integer
> type. a can be a pointer or an arithmetic type.

This could have been outlawed and replaced by &a[b]. Of course,
currently, a[b] is defined as *(a+b) so it relies on pointer arithmetic,
but a[b] could have been defined independently so as to have a+b
generate a warning. I don't think this was ever a consideration.

--
Ben.

Re: Why does the -> operator exist ?

<u7etsq$1e0jo$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Tue, 27 Jun 2023 16:06:03 +0100
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <u7etsq$1e0jo$1@dont-email.me>
References: <trfLpf+N71iCzEwJm@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 27 Jun 2023 15:06:02 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="56eff6d0f8b6e81bff954af41b9efe26";
logging-data="1507960"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18SI4Xnt+cdOO6NIc+PEBiLaDeP4IFcC0o="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:jORlpq150Pc0W8c9C2MuMuBaim0=
In-Reply-To: <trfLpf+N71iCzEwJm@bongo-ra.co>
 by: Bart - Tue, 27 Jun 2023 15:06 UTC

On 27/06/2023 10:12, Spiros Bousbouras wrote:
> I mean would it create an ambiguity if you could write s.field
> both when s is a structure or union and when s is a pointer
> to a structure or union ?

I thought you meant why C allows P->m since it does exactly the same
thing as (*P).m.

From your other comment, you are asking why have a dereference between
P and m at all.

Actually this could have been made optional in this case:

struct S* P;
struct S Q;

P.m + Q.m; // compiler transforms this to (*P).m + Q.m;

You lose some transparency, but reduce clutter and improve readability
by not having to type (*P).m or P->m.

However you will still need it in other contexts such as:

P;

is this evaluating the pointer, or the struct it points to? Here you
need to choose between P and *P (-> doesn't help here: there is no member).

Re: Why does the -> operator exist ?

<u7eua9$1dvag$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: lew.pitc...@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Tue, 27 Jun 2023 15:13:13 -0000 (UTC)
Organization: The Pitcher Digital Freehold
Lines: 54
Message-ID: <u7eua9$1dvag$1@dont-email.me>
References: <trfLpf+N71iCzEwJm@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 27 Jun 2023 15:13:13 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="18c3801d24fa09357dcac7f139e29c4a";
logging-data="1506640"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX181w5jjayFrUac8b2dKCmOMDuCJMn4mHss="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:KvWOZOtUBAf5/SV3z2T51rS4oH0=
 by: Lew Pitcher - Tue, 27 Jun 2023 15:13 UTC

On Tue, 27 Jun 2023 09:12:09 +0000, Spiros Bousbouras wrote:

To answer your Subject line question "Why does the -> operator exist?",
let's look at K&R "The C Programming Language" (1st edition):

(In discusson about pointers to structures, and access to structure
elements through such pointers, using a date structure and a pointer
(pd) to such structure as an example)
"If
p
is a pointer to a structure, then
p->member-of-structure
refers to the particular member. Since
pd
points to the structure, the
year
member could also be refered to as
(*pd).year
but pointers to structures are so frequently used that the ->
notation is provided as a convenient shorthand."

So, -> is syntactic sugar

> I mean would it create an ambiguity if you could write s.field
> both when s is a structure or union and when s is a pointer
> to a structure or union ?

If
s
is a POINTER, then
s.field
would not just be "ambigious", it would be /wrong/. POINTERs do
not have members, STRUCTURES do.

If, given
struct {
int a;
char b;
} a, *s = &a;
the C language permitted
s.a = 3;
then
s
must be considered to be the entirety of the structure. So, what
would
if (s == &a)
test? Would it test the /addresses/ of the two structures, or
would it test the /contents/ of the two structures?

So, yes, your suggestion (as it stands) leads to ambiguity.
--
Lew Pitcher
"In Skills We Trust"

Re: Why does the -> operator exist ?

<20230627082343.242@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Tue, 27 Jun 2023 15:30:17 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <20230627082343.242@kylheku.com>
References: <trfLpf+N71iCzEwJm@bongo-ra.co>
Injection-Date: Tue, 27 Jun 2023 15:30:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="26b07ff97fa3875db086587d7384c1d6";
logging-data="1513974"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18cwivmcTiU3dcjE3Jj6CekowJx7S1zkvA="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:DCjd1GWekmVtmZNZ6u7/Co7ZloA=
 by: Kaz Kylheku - Tue, 27 Jun 2023 15:30 UTC

On 2023-06-27, Spiros Bousbouras <spibou@gmail.com> wrote:
> I mean would it create an ambiguity if you could write s.field
> both when s is a structure or union and when s is a pointer
> to a structure or union ?

1. I suspect early C compilers didn't always maintain the type information
to be able to do that, though that isn't difficult to remedy.
You just have to know "is this declared as a pointer or not".

2. a->b was invented as a shorthand for (*a).b. Maybe that detour was
enough of a distraction not to make it immediately obvious
that another way to do that would be to have a.b have that
meaning whenever a is a pointer. That said, there is enough pointer
"decay" in C; this would just be another instance. Just like
(***f)(), (*f) and f() are equivalent (***a).b, (*a).b and a.b
could be identical.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: Why does the -> operator exist ?

<u7f0nq$1ecr1$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: cr88...@gmail.com (BGB)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Tue, 27 Jun 2023 10:54:32 -0500
Organization: A noiseless patient Spider
Lines: 126
Message-ID: <u7f0nq$1ecr1$1@dont-email.me>
References: <trfLpf+N71iCzEwJm@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 27 Jun 2023 15:54:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f949094e013551065d35749fb3f0f003";
logging-data="1520481"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XXw4YP6mhrBuOAtdlVOLG"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:9XI7XFHucVJzMnkRs4/kE3NgTo0=
Content-Language: en-US
In-Reply-To: <trfLpf+N71iCzEwJm@bongo-ra.co>
 by: BGB - Tue, 27 Jun 2023 15:54 UTC

On 6/27/2023 4:12 AM, Spiros Bousbouras wrote:
> I mean would it create an ambiguity if you could write s.field
> both when s is a structure or union and when s is a pointer
> to a structure or union ?

The distinction between "obj.field" and "obj->field" is likely almost
entirely historical.

In my compiler (mostly used for targeting my own CPU ISA), they are
essentially treated as equivalent, and there is no real ill effect from
doing so.

The most one could really do here would be to separate them in the
front-end for long enough that one can be like "Dude, you used the wrong
operator for the type of expression." and then revert to treating them
as equivalent from then on.

It would have mattered more for early versions of C, but as it stands
the two original use-cases are mutually exclusive.

Is sometimes a minor annoyance when porting code back to other compilers
which do actually care about the difference in cases where the incorrect
operator had ended up being used for whatever reason (assuming code that
is "relatively free" of the use of language extensions).

The most annoying at present being that of 128-big integers (__int128)
which is only supported for certain combinations of compiler and target.

Say:
MSVC: Generally no (except to say that it is unsupported);
GCC: Only on certain targets;
And, IIRC, neither GCC nor Clang supports 128-bit integer constants.
...

Similarly goes for the lack of de-facto standard or portable support for
fixed and floating-point SIMD vectors and operations.

Say:
MSVC: Well, you got "xmmintrin.h", but it sucks;
GCC: The "__attribute__((vector_size(16)))" system;
...

In my compiler, it is sort of a custom system:
Sort of part-way maps vaguely GLSL style semantics onto C;
Native types being things like:
__vec4f : 4x Binary32
__vec4h : 4x Binary16
__quatf : 4x Binary32 (Quaternion)
__vec2f : 2x Binary32
__vec2d : 2x Binary64
...
Some storage-only special cases:
__vec2h : 2x Binary16
Roughly __vec4h internally just with 32-bit storage.
__vec3f : 3x Binary32
...

The _Complex and _Imaginary types map through the same system.
Complex types can also be cast to quaternions.
With typical vector operators:
+ / - : Pairwise add/sub
* / / : Pairfile multiply divide (excludes quaternions)
For Quaternions, A*B gives a quaternion product, ...
^ : Dot Product
% : Cross Product (depends on vector type)
Pseudo fields can be used for shuffle:
"vec.wzyx" would reverse the elements, etc.
"vec.xz" to extract X and Z as a 2-element vector
"vec.xxxx", ...
"vec.x": Extract a single field.
Can also be composed like, say, "(__vec4f){1,2,3,4}".
...
Uses "__m128" and similar, but as the vector analog of "void *".
Casting vectors:
__m128 <-> __int128 : Bit copy.
__m128 <-> __vec4f/...: Bit copy.
__m64 <-> long long : Bit copy.
__m64 <-> double: Bit Copy.
Direct cast between other types attempts to convert types by value.
Will fail if there is a structural mismatch between the types.
__vec4f <-> __vec4h: Fine (converts element representation).
__vec4f <-> __vec2d: Bad (same size, but structural mismatch).

There is partial (but much less used or tested) support for matrix types
and operators.

My compiler can also accept GCC's syntax (for cases where there is
semantic overlap).

There is not currently any built in support for things like
exterior/wedge/tensor operators, but are not entirely off the table (for
the time being, these would need to be implemented as library features).

For portability, a lot of this can be wrapped in macros and similar and
then expressed in a way appropriate to other compilers as needed (say,
using the SSE / "xmmintrin.h" functions in MSVC, ...), but this is
annoying and more awkward to use.

Unlike the MSVC intrinsics, there is no assumption of a direct 1:1
mapping with underlying instructions in the ISA in my case (and some
operators may be internally implemented using function calls; and some
larger types, 256-bit or more, are memory-backed types, ...).

Also partly annoying being cases where Binary16 floating-point is used
(expressed as a "short float" type), which is absent on most other
targets. Mostly relevant for space-saving when Binary32 is overkill
(internally in my ABI, most scalar floating-point types are expressed
using Binary64 in registers; so the type mostly effects storage, and
occasionally the choice of operator).

There are a lot of other extensions, but for code that needs to be able
to be moved between compilers, the use of extension features needs to be
kept to a minimum.

....

Re: Why does the -> operator exist ?

<u7f1c8$1ef65$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Tue, 27 Jun 2023 17:05:28 +0100
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <u7f1c8$1ef65$1@dont-email.me>
References: <trfLpf+N71iCzEwJm@bongo-ra.co> <20230627082343.242@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 27 Jun 2023 16:05:28 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="56eff6d0f8b6e81bff954af41b9efe26";
logging-data="1522885"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/LbqqVsGgTHc+0u3smV7k/1E8kO9I8xYg="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:Q8rJPGquC5D+hdiHOL4UU35L3x4=
In-Reply-To: <20230627082343.242@kylheku.com>
 by: Bart - Tue, 27 Jun 2023 16:05 UTC

On 27/06/2023 16:30, Kaz Kylheku wrote:
> On 2023-06-27, Spiros Bousbouras <spibou@gmail.com> wrote:
>> I mean would it create an ambiguity if you could write s.field
>> both when s is a structure or union and when s is a pointer
>> to a structure or union ?
>
> 1. I suspect early C compilers didn't always maintain the type
information
> to be able to do that, though that isn't difficult to remedy.
> You just have to know "is this declared as a pointer or not".
>
> 2. a->b was invented as a shorthand for (*a).b. Maybe that detour was
> enough of a distraction not to make it immediately obvious
> that another way to do that would be to have a.b have that
> meaning whenever a is a pointer. That said, there is enough pointer
> "decay" in C; this would just be another instance. Just like
> (***f)(), (*f) and f() are equivalent

It depends on the type of f. You can have any number of extra * than are
necessary, but no more than one fewer.

Pointer decay in other cases is anyway due to following certain rules of
the language. There are no such rules for pointers to structs AIUI.

(I allow such derefs to be optional in my language, but the type system
requires them. So it works by the compiler adding in the explicit derefs
that I omitted.

I didn't like this loss of transparency at first, but the cleaner code,
and the way it simplifies porting to my other language which doesn't use
pointers, makes it worth it.)

Re: Why does the -> operator exist ?

<874jmsq1p7.fsf@bsb.me.uk>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Tue, 27 Jun 2023 18:01:24 +0100
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <874jmsq1p7.fsf@bsb.me.uk>
References: <trfLpf+N71iCzEwJm@bongo-ra.co> <u7etsq$1e0jo$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="42bc170245e1698a7bd97066840a5ff2";
logging-data="1533412"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/y9T9i7QMS4d6ehNVnaEw6ftf0bqHlxk="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:BXNR+dtsCR25ym2agEUkxxwOUl8=
sha1:Zzwj7Vp4suhqqFr3B+AmF6POe2w=
X-BSB-Auth: 1.a7897a727ac793339291.20230627180124BST.874jmsq1p7.fsf@bsb.me.uk
 by: Ben Bacarisse - Tue, 27 Jun 2023 17:01 UTC

Bart <bc@freeuk.com> writes:

> On 27/06/2023 10:12, Spiros Bousbouras wrote:
>> I mean would it create an ambiguity if you could write s.field
>> both when s is a structure or union and when s is a pointer
>> to a structure or union ?
>
> I thought you meant why C allows P->m since it does exactly the same thing
> as (*P).m.
>
> From your other comment, you are asking why have a dereference between P
> and m at all.
>
> Actually this could have been made optional in this case:
>
> struct S* P;
> struct S Q;
>
> P.m + Q.m; // compiler transforms this to (*P).m + Q.m;
>
> You lose some transparency, but reduce clutter and improve readability by
> not having to type (*P).m or P->m.
>
> However you will still need it in other contexts such as:
>
> P;
>
> is this evaluating the pointer, or the struct it points to?

The suggestion, I think, was simply to all . on a struct pointer instead
of requiring ->.

> Here you need
> to choose between P and *P (-> doesn't help here: there is no member).

--
Ben.

Re: Why does the -> operator exist ?

<20230627100523.643@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Tue, 27 Jun 2023 17:11:16 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <20230627100523.643@kylheku.com>
References: <trfLpf+N71iCzEwJm@bongo-ra.co> <20230627082343.242@kylheku.com>
<u7f1c8$1ef65$1@dont-email.me>
Injection-Date: Tue, 27 Jun 2023 17:11:16 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="26b07ff97fa3875db086587d7384c1d6";
logging-data="1535728"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+lPLvNO2gKilRBsqabQvRqx/1R0T6kRNE="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:iIZk9CZwVoBV1U90XaREBMRcAfc=
 by: Kaz Kylheku - Tue, 27 Jun 2023 17:11 UTC

On 2023-06-27, Bart <bc@freeuk.com> wrote:
> On 27/06/2023 16:30, Kaz Kylheku wrote:
> > On 2023-06-27, Spiros Bousbouras <spibou@gmail.com> wrote:
> >> I mean would it create an ambiguity if you could write s.field
> >> both when s is a structure or union and when s is a pointer
> >> to a structure or union ?
> >
> > 1. I suspect early C compilers didn't always maintain the type
> information
> > to be able to do that, though that isn't difficult to remedy.
> > You just have to know "is this declared as a pointer or not".
> >
> > 2. a->b was invented as a shorthand for (*a).b. Maybe that detour was
> > enough of a distraction not to make it immediately obvious
> > that another way to do that would be to have a.b have that
> > meaning whenever a is a pointer. That said, there is enough pointer
> > "decay" in C; this would just be another instance. Just like
> > (***f)(), (*f) and f() are equivalent
>
> It depends on the type of f. You can have any number of extra * than are
> necessary, but no more than one fewer.

Right; f is supposed to be a function type here (or a pointer to
function). Obviously if is a pointer-to-pointer to function,
one dereference is non-negotiable.

> (I allow such derefs to be optional in my language, but the type system
> requires them. So it works by the compiler adding in the explicit derefs
> that I omitted.

Makes sense. So that is a form of syntactic sugar (under the school
of thought that static type is part of syntax).

> I didn't like this loss of transparency at first, but the cleaner code,
> and the way it simplifies porting to my other language which doesn't use
> pointers, makes it worth it.)

Also easier refactoring: like when objects switch from aggregation to
composition. Or function arguments from structures to pointers.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: Why does the -> operator exist ?

<u7f79q$1f1pr$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: cr88...@gmail.com (BGB)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Tue, 27 Jun 2023 12:46:33 -0500
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <u7f79q$1f1pr$1@dont-email.me>
References: <trfLpf+N71iCzEwJm@bongo-ra.co> <u7etsq$1e0jo$1@dont-email.me>
<874jmsq1p7.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 27 Jun 2023 17:46:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f949094e013551065d35749fb3f0f003";
logging-data="1541947"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19qoAKpwRJEBEQORI1WkhLx"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:OgTxSPaw3UCBGL312rJbNDrgxC4=
In-Reply-To: <874jmsq1p7.fsf@bsb.me.uk>
Content-Language: en-US
 by: BGB - Tue, 27 Jun 2023 17:46 UTC

On 6/27/2023 12:01 PM, Ben Bacarisse wrote:
> Bart <bc@freeuk.com> writes:
>
>> On 27/06/2023 10:12, Spiros Bousbouras wrote:
>>> I mean would it create an ambiguity if you could write s.field
>>> both when s is a structure or union and when s is a pointer
>>> to a structure or union ?
>>
>> I thought you meant why C allows P->m since it does exactly the same thing
>> as (*P).m.
>>
>> From your other comment, you are asking why have a dereference between P
>> and m at all.
>>
>> Actually this could have been made optional in this case:
>>
>> struct S* P;
>> struct S Q;
>>
>> P.m + Q.m; // compiler transforms this to (*P).m + Q.m;
>>
>> You lose some transparency, but reduce clutter and improve readability by
>> not having to type (*P).m or P->m.
>>
>> However you will still need it in other contexts such as:
>>
>> P;
>>
>> is this evaluating the pointer, or the struct it points to?
>
> The suggestion, I think, was simply to all . on a struct pointer instead
> of requiring ->.
>

Which, ironically enough, seems to works fine in practice as with the
current type system, there are no cases in C where '.' vs '->' could be
(functionally) ambiguous, merely cases where one is allowed but the
other is not...

>> Here you need
>> to choose between P and *P (-> doesn't help here: there is no member).
>

Re: Why does the -> operator exist ?

<87fs6cso8n.fsf@nosuchdomain.example.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Tue, 27 Jun 2023 12:23:52 -0700
Organization: None to speak of
Lines: 44
Message-ID: <87fs6cso8n.fsf@nosuchdomain.example.com>
References: <trfLpf+N71iCzEwJm@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="a853ce57f0cc376f52e20a2b97585134";
logging-data="1563473"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ASAIdIbC1PVtJpbE6rd5N"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:CQZxv3ICZcq5pvjiPdrX6VHPg2o=
sha1:XW0cNPJ8DxbSIaHqg2EDfBGSR0I=
 by: Keith Thompson - Tue, 27 Jun 2023 19:23 UTC

Spiros Bousbouras <spibou@gmail.com> writes:
> I mean would it create an ambiguity if you could write s.field
> both when s is a structure or union and when s is a pointer
> to a structure or union ?

There are languages that use the `.` operator for selecting a member
from either a structure or a pointer to a structure. Since `.name` with
a pointer prefix has no other meaning, no ambiguity is introduced. (Ada
is an example.)

In early C (before K&R1), `prefix.member` treated the prefix as a
structure with a member named `member`, regardless of how `prefix` was
actually defined. Member definitions were associated with struct
definitions, but were not tied to them. Given:

struct foo {
int x;
int y;
};

the name `x` meant `an int member at an offset of 0`, and `.x` could be
applied to any lvalue. (This is why member names for standard library
types have unique prefixes, like the tm_sec, tm_min, ... members of
struct tm.)

Thus `foo.x` where foo is a pointer would extract an int from the bytes
making up the representation of the pointer object, while `(*foo).x` or
equivalently `foo->x` would dereference foo and extract an int from the
object foo points to.

Some time between 1975 and 1978, the rules were changed so a member name
applies only to the struct (or union) type in which it's defined, but
the meaning of the `.` operator was never updated. It *could* have
been, but it's not clear to me that it would have been worth the effort.
The `->` operator would have had to be left in place to avoid breaking
existing code, leaving us with two different ways to write the same
thing. Also, I would argue that using `->` rather than `.` when the
prefix is a pointer makes for more explicit code, which is a good thing;
it's important to know when you're dealing with pointers.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: Why does the -> operator exist ?

<1bjzvo614r.fsf@pfeifferfamily.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: pfeif...@cs.nmsu.edu (Joe Pfeiffer)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Tue, 27 Jun 2023 15:33:56 -0600
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <1bjzvo614r.fsf@pfeifferfamily.net>
References: <trfLpf+N71iCzEwJm@bongo-ra.co>
<87fs6cso8n.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="7e5c26adcb081d255a51652b82f0f064";
logging-data="1588421"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18c0e+IPKwR7HD0qqpWgER9FDK9ptUqFuk="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:v2JbLGl1SbgeVIAipWwEbmvtK8o=
sha1:sDnmTTOecCY+5Nrk/wEcOurXAbk=
 by: Joe Pfeiffer - Tue, 27 Jun 2023 21:33 UTC

I've always preferred Pascal's syntax for this, on the basis of consistency:

foo is a pointer
foo^ is the record foo points to
foo^.bar is a field in the record

If baz is itself a record,
baz.bar is a field in the record

But of course that ship sailed nearly fifty years ago.

Re: Why does the -> operator exist ?

<5HB1OjHg4nJp9zZwI@bongo-ra.co>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!paganini.bofh.team!not-for-mail
From: spi...@gmail.com (Spiros Bousbouras)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Wed, 28 Jun 2023 16:31:42 -0000 (UTC)
Organization: To protect and to server
Message-ID: <5HB1OjHg4nJp9zZwI@bongo-ra.co>
References: <trfLpf+N71iCzEwJm@bongo-ra.co> <87fs6cso8n.fsf@nosuchdomain.example.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 28 Jun 2023 16:31:42 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="3769342"; posting-host="9H7U5kayiTdk7VIdYU44Rw.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team"; posting-account="9dIQLXBM7WM9KzA+yjdR4A";
Cancel-Lock: sha256:YMXqadHOmVlAKcjAwKaUmk/ifAW7aXBbQlnSW/WN6AQ=
X-Notice: Filtered by postfilter v. 0.9.3
X-Server-Commands: nowebcancel
X-Organisation: Weyland-Yutani
 by: Spiros Bousbouras - Wed, 28 Jun 2023 16:31 UTC

On Tue, 27 Jun 2023 12:23:52 -0700
Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
> Spiros Bousbouras <spibou@gmail.com> writes:
> > I mean would it create an ambiguity if you could write s.field
> > both when s is a structure or union and when s is a pointer
> > to a structure or union ?
>
> There are languages that use the `.` operator for selecting a member
> from either a structure or a pointer to a structure. Since `.name` with
> a pointer prefix has no other meaning, no ambiguity is introduced. (Ada
> is an example.)

Interesting. I thought one of the design principles of Ada was to be
explicit , with the idea that it helps reduce bugs.

> In early C (before K&R1), `prefix.member` treated the prefix as a
> structure with a member named `member`, regardless of how `prefix` was
> actually defined. Member definitions were associated with struct
> definitions, but were not tied to them. Given:
>
> struct foo {
> int x;
> int y;
> };
>
> the name `x` meant `an int member at an offset of 0`, and `.x` could be
> applied to any lvalue. (This is why member names for standard library
> types have unique prefixes, like the tm_sec, tm_min, ... members of
> struct tm.)
>
> Thus `foo.x` where foo is a pointer would extract an int from the bytes
> making up the representation of the pointer object, while `(*foo).x` or
> equivalently `foo->x` would dereference foo and extract an int from the
> object foo points to.

Even more interesting and it might even have been useful back then. Say
you have integer types T2 and T1 with T2 being double the width of T1
and you know enough about the layout of the bits in memory ; then you
can do something like

struct two_faced_integer {
T1 i1 ;
T1 i2 ;
} ;

Then if you have an object o of type T2 then you could do o.i1 and
o.i2 to get 2 integers of type T1 .In an era where compilers and
processors weren't doing the optimisations they do today , this might have
been handy.

> Some time between 1975 and 1978, the rules were changed so a member name
> applies only to the struct (or union) type in which it's defined, but
> the meaning of the `.` operator was never updated. It *could* have
> been, but it's not clear to me that it would have been worth the effort.
> The `->` operator would have had to be left in place to avoid breaking
> existing code, leaving us with two different ways to write the same
> thing.

If -> was already present then it wouldn't make sense to give s.field
an idiomatic meaning when s is a pointer , it would just be an additional
complexity.

> Also, I would argue that using `->` rather than `.` when the
> prefix is a pointer makes for more explicit code, which is a good thing;
> it's important to know when you're dealing with pointers.

I have no strong feelings either way but I was under the impression that
Ada people do have strong feelings in favour of being explicit hence my
surprise at how Ada does things.

--
vlaho.ninja/prog

Re: Why does the -> operator exist ?

<u7i809$1sa5s$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: andreyta...@hotmail.com (Andrey Tarasevich)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Wed, 28 Jun 2023 14:16:57 -0700
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <u7i809$1sa5s$1@dont-email.me>
References: <trfLpf+N71iCzEwJm@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 28 Jun 2023 21:16:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3e47699852f14fd244559f4d761fe696";
logging-data="1976508"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19i+604zqU7z8n7w3wUhMUy"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:dXQ8Imp4UY1vAusbzZlrM2ulu0o=
In-Reply-To: <trfLpf+N71iCzEwJm@bongo-ra.co>
Content-Language: en-US
 by: Andrey Tarasevich - Wed, 28 Jun 2023 21:16 UTC

On 6/27/2023 2:12 AM, Spiros Bousbouras wrote:
> I mean would it create an ambiguity if you could write s.field
> both when s is a structure or union and when s is a pointer
> to a structure or union ?

The original `->` operator first introduced in nascent C language was
not a mere shorthand for `*`-then-`.` combination. It supported its own
exclusive functionality, like dereferencing integer addresses.

At the same time '.' operator also worked completely differently from
how it works in modern C: filed names were not associated with specific
struct types and `.` could be applied to an lvalue of any type.

So, in nascent C you could write code like the following

struct S
{
int a, b;
/* Field `b` is offset `sizeof(int)` bytes from
the beginning of the struct */
};

int main()
{
int addr = 0x1234;

addr->b = 42;
/* Assign `42` to an `int` at address `0x1234+sizeof(int)` */

addr.b = 42;
/* Assign `42` to an `int` at address `&i+sizeof(int)` */

...
}

So, yes, back then there was obvious ambiguity between the two. That's
why it existed.

Later the language changed. Field names became tightly associated with
their struct types, while `->` turned into the exact equivalent for
`*`-then-`.` combination.

--
Best regards,
Andrey

Re: Why does the -> operator exist ?

<20230628200210.747@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Thu, 29 Jun 2023 03:14:07 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <20230628200210.747@kylheku.com>
References: <trfLpf+N71iCzEwJm@bongo-ra.co>
<87fs6cso8n.fsf@nosuchdomain.example.com> <5HB1OjHg4nJp9zZwI@bongo-ra.co>
Injection-Date: Thu, 29 Jun 2023 03:14:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cd89465aee80337fbcf1ba26f49e209b";
logging-data="2169640"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19wid/gX2jIByiGWqHvn+Uh9fS8xnGFtcw="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:0ZQoydeqkomjfVi5M7F147qPJHE=
 by: Kaz Kylheku - Thu, 29 Jun 2023 03:14 UTC

On 2023-06-28, Spiros Bousbouras <spibou@gmail.com> wrote:
> On Tue, 27 Jun 2023 12:23:52 -0700
> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>> Spiros Bousbouras <spibou@gmail.com> writes:
>> > I mean would it create an ambiguity if you could write s.field
>> > both when s is a structure or union and when s is a pointer
>> > to a structure or union ?
>>
>> There are languages that use the `.` operator for selecting a member
>> from either a structure or a pointer to a structure. Since `.name` with
>> a pointer prefix has no other meaning, no ambiguity is introduced. (Ada
>> is an example.)
>
> Interesting. I thought one of the design principles of Ada was to be
> explicit , with the idea that it helps reduce bugs.

Using two tokens for two different situations is no more or less
explicit than one.

a->b does two things: dereferences the pointer and selects a member;
if we change the spelling of the operator, that doesn't change
the semantics.

To be explicit, you have to use (*a).b so that this is done using
two separate operators: *a does the dereferencing to produce
a structure, whose member is then selected.

If the same operator is used, it's a case of overloading.

But Ada is not against overloading: it supports operator overloading!

Re: Why does the -> operator exist ?

<86fs5ivxfu.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Thu, 20 Jul 2023 18:57:09 -0700
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <86fs5ivxfu.fsf@linuxsc.com>
References: <trfLpf+N71iCzEwJm@bongo-ra.co> <87fs6cso8n.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="2d78163bfb891e7187c96a580a5a5784";
logging-data="3116812"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19jQcMhyAJLZiMc7DvlZHNPOpmkhMhDrW8="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:7VbtVUfOGeI85k4xSDXYxaY+DDA=
sha1:ST/jltUrjLnmWQ5/WWyTQmr5LPA=
 by: Tim Rentsch - Fri, 21 Jul 2023 01:57 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> [...] I would argue that using `->` rather than `.` when the
> prefix is a pointer makes for more explicit code, which is a good
> thing; [...]

More explicit is not always better.

Re: Why does the -> operator exist ?

<874jlyq8re.fsf@nosuchdomain.example.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Thu, 20 Jul 2023 19:49:09 -0700
Organization: None to speak of
Lines: 18
Message-ID: <874jlyq8re.fsf@nosuchdomain.example.com>
References: <trfLpf+N71iCzEwJm@bongo-ra.co>
<87fs6cso8n.fsf@nosuchdomain.example.com> <86fs5ivxfu.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="2370f913b850030e0527dd0f7396627d";
logging-data="3257535"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/674hmNTmaVhsRuvvMbtgo"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:fo60lt3AeJTclmhMSz2IJofqEI4=
sha1:2/0lEqsI9zffpv5W87ehbQjhI+w=
 by: Keith Thompson - Fri, 21 Jul 2023 02:49 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>> [...] I would argue that using `->` rather than `.` when the
>> prefix is a pointer makes for more explicit code, which is a good
>> thing; [...]
>
> More explicit is not always better.

No, it isn't.

If you had anything to say about this particular case (`->` being more
explicit than `.`, and whether it's better), this would have been a good
opportunity to say it.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: Why does the -> operator exist ?

<20230721223748.150@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Sat, 22 Jul 2023 05:39:37 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <20230721223748.150@kylheku.com>
References: <trfLpf+N71iCzEwJm@bongo-ra.co>
<87fs6cso8n.fsf@nosuchdomain.example.com> <86fs5ivxfu.fsf@linuxsc.com>
Injection-Date: Sat, 22 Jul 2023 05:39:37 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b30b716b22f4706121b4a047272243a6";
logging-data="3900032"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+HCbPrNEc2OT9aUoEhAx/+/rKW7+yBnXc="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:KCTnQUzK66XbhwavH4Q6mUVkR68=
 by: Kaz Kylheku - Sat, 22 Jul 2023 05:39 UTC

On 2023-07-21, Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>
>> [...] I would argue that using `->` rather than `.` when the
>> prefix is a pointer makes for more explicit code, which is a good
>> thing; [...]
>
> More explicit is not always better.

There is good explicit and bad explicit.

Good implicit and bad implicit, likewise.

E.g. strtok implicitly using a global variable is not so hot.

"continue;" branching to an implicit top-of-loop label is fairly decent.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: Why does the -> operator exist ?

<86pm3xbswl.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Tue, 08 Aug 2023 05:49:46 -0700
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <86pm3xbswl.fsf@linuxsc.com>
References: <trfLpf+N71iCzEwJm@bongo-ra.co> <87fs6cso8n.fsf@nosuchdomain.example.com> <86fs5ivxfu.fsf@linuxsc.com> <874jlyq8re.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="996336b78d58b8cbe9ae682ecb3e6882";
logging-data="3580797"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+3pU37N4//0Ng2aF6WRVBldaWQtQqMK4o="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:kXTOuEIH93Y9LzPh1TN+UFwl66s=
sha1:BX3dn6O+f/h2iLAlv6yr5Vt2lnw=
 by: Tim Rentsch - Tue, 8 Aug 2023 12:49 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>
>>> [...] I would argue that using `->` rather than `.` when the
>>> prefix is a pointer makes for more explicit code, which is a
>>> good thing; [...]
>>
>> More explicit is not always better.
>
> No, it isn't.
>
> If you had anything to say about this particular case (`->` being
> more explicit than `.`, and whether it's better), this would have
> been a good opportunity to say it.

In the particular case of using '.' instead of '->', more
explicit is not always better.

Re: Why does the -> operator exist ?

<877cq5qfc6.fsf@nosuchdomain.example.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: Why does the -> operator exist ?
Date: Tue, 08 Aug 2023 16:33:45 -0700
Organization: None to speak of
Lines: 25
Message-ID: <877cq5qfc6.fsf@nosuchdomain.example.com>
References: <trfLpf+N71iCzEwJm@bongo-ra.co>
<87fs6cso8n.fsf@nosuchdomain.example.com> <86fs5ivxfu.fsf@linuxsc.com>
<874jlyq8re.fsf@nosuchdomain.example.com> <86pm3xbswl.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="913a52d54f1fb8cef77698b79d9b2607";
logging-data="3774181"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18XVOlIgy82NBANEFypVhNf"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:5PuYP7cfLGqSKy1u2S4Tng7X2/E=
sha1:3megxgcMX1dCdT5ah3OgnqpBRAs=
 by: Keith Thompson - Tue, 8 Aug 2023 23:33 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>>> [...] I would argue that using `->` rather than `.` when the
>>>> prefix is a pointer makes for more explicit code, which is a
>>>> good thing; [...]
>>>
>>> More explicit is not always better.
>>
>> No, it isn't.
>>
>> If you had anything to say about this particular case (`->` being
>> more explicit than `.`, and whether it's better), this would have
>> been a good opportunity to say it.
>
> In the particular case of using '.' instead of '->', more
> explicit is not always better.

That's a useless statement.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: Why does the -> operator exist ?

<fe29aa20-4afa-4259-897b-5943cd224708n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a37:b4c2:0:b0:76c:be58:d76e with SMTP id d185-20020a37b4c2000000b0076cbe58d76emr26687qkf.0.1691564884620;
Wed, 09 Aug 2023 00:08:04 -0700 (PDT)
X-Received: by 2002:a05:6808:180a:b0:3a7:8398:482f with SMTP id
bh10-20020a056808180a00b003a78398482fmr1187062oib.6.1691564884438; Wed, 09
Aug 2023 00:08:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 9 Aug 2023 00:08:03 -0700 (PDT)
In-Reply-To: <u7etsq$1e0jo$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.137; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.137
References: <trfLpf+N71iCzEwJm@bongo-ra.co> <u7etsq$1e0jo$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fe29aa20-4afa-4259-897b-5943cd224708n@googlegroups.com>
Subject: Re: Why does the -> operator exist ?
From: profesor...@gmail.com (fir)
Injection-Date: Wed, 09 Aug 2023 07:08:04 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 33
 by: fir - Wed, 9 Aug 2023 07:08 UTC

wtorek, 27 czerwca 2023 o 17:06:17 UTC+2 Bart napisał(a):
> On 27/06/2023 10:12, Spiros Bousbouras wrote:
> > I mean would it create an ambiguity if you could write s.field
> > both when s is a structure or union and when s is a pointer
> > to a structure or union ?
> I thought you meant why C allows P->m since it does exactly the same
> thing as (*P).m.
>
> From your other comment, you are asking why have a dereference between
> P and m at all.
>
> Actually this could have been made optional in this case:
>
> struct S* P;
> struct S Q;
>
> P.m + Q.m; // compiler transforms this to (*P).m + Q.m;
>
> You lose some transparency, but reduce clutter and improve readability
> by not having to type (*P).m or P->m.
>

allowing it for fields would be incoherent with normal pointers so if so
it would bebetter to skip * for all (but not for sole fields) - i was writing on this
some years ago...there is general problem with pointers in c imo

here problem is rather this idiotic convention that* sticks to right (as far as i remeber
if i remember wrong some could correct me) in *a.b.c.d.e becouse if you would use *a.b.*c.d.e what does it mean ? a.b.c.d.**e ? * should stick immediate and then you coud write s.*p or *s.p
with no problem

Re: Why does the -> operator exist ?

<d58e86ab-df04-4ba4-9cdf-73020ae45e87n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:6214:5656:b0:63c:ebe9:2467 with SMTP id mh22-20020a056214565600b0063cebe92467mr24995qvb.13.1691565113688;
Wed, 09 Aug 2023 00:11:53 -0700 (PDT)
X-Received: by 2002:a05:6808:1a03:b0:39e:de07:a6b7 with SMTP id
bk3-20020a0568081a0300b0039ede07a6b7mr1117155oib.1.1691565113306; Wed, 09 Aug
2023 00:11:53 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 9 Aug 2023 00:11:52 -0700 (PDT)
In-Reply-To: <fe29aa20-4afa-4259-897b-5943cd224708n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.137; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.137
References: <trfLpf+N71iCzEwJm@bongo-ra.co> <u7etsq$1e0jo$1@dont-email.me> <fe29aa20-4afa-4259-897b-5943cd224708n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d58e86ab-df04-4ba4-9cdf-73020ae45e87n@googlegroups.com>
Subject: Re: Why does the -> operator exist ?
From: profesor...@gmail.com (fir)
Injection-Date: Wed, 09 Aug 2023 07:11:53 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2909
 by: fir - Wed, 9 Aug 2023 07:11 UTC

środa, 9 sierpnia 2023 o 09:08:12 UTC+2 fir napisał(a):
> wtorek, 27 czerwca 2023 o 17:06:17 UTC+2 Bart napisał(a):
> > On 27/06/2023 10:12, Spiros Bousbouras wrote:
> > > I mean would it create an ambiguity if you could write s.field
> > > both when s is a structure or union and when s is a pointer
> > > to a structure or union ?
> > I thought you meant why C allows P->m since it does exactly the same
> > thing as (*P).m.
> >
> > From your other comment, you are asking why have a dereference between
> > P and m at all.
> >
> > Actually this could have been made optional in this case:
> >
> > struct S* P;
> > struct S Q;
> >
> > P.m + Q.m; // compiler transforms this to (*P).m + Q.m;
> >
> > You lose some transparency, but reduce clutter and improve readability
> > by not having to type (*P).m or P->m.
> >
> allowing it for fields would be incoherent with normal pointers so if so
> it would bebetter to skip * for all (but not for sole fields) - i was writing on this
> some years ago...there is general problem with pointers in c imo
>
> here problem is rather this idiotic convention that* sticks to right (as far as i remeber
> if i remember wrong some could correct me) in *a.b.c.d.e becouse if you would use *a.b.*c.d.e what does it mean ? a.b.c.d.**e ? * should stick immediate and then you coud write s.*p or *s.p
> with no problem

i dont know who set this way (thompson, ritche or someone elese?_ but its incoherent with generally c being not idioptic becouse this *a.*b.c working as i remember is idiotic

Re: Why does the -> operator exist ?

<d49458c0-49b6-46c9-ac7a-8da743484273n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ad4:4b22:0:b0:63d:3d3:1dd4 with SMTP id s2-20020ad44b22000000b0063d03d31dd4mr27895qvw.4.1691565814210;
Wed, 09 Aug 2023 00:23:34 -0700 (PDT)
X-Received: by 2002:a05:6870:8c11:b0:1c0:3431:621 with SMTP id
ec17-20020a0568708c1100b001c034310621mr589858oab.6.1691565813999; Wed, 09 Aug
2023 00:23:33 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 9 Aug 2023 00:23:33 -0700 (PDT)
In-Reply-To: <d58e86ab-df04-4ba4-9cdf-73020ae45e87n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.137; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.137
References: <trfLpf+N71iCzEwJm@bongo-ra.co> <u7etsq$1e0jo$1@dont-email.me>
<fe29aa20-4afa-4259-897b-5943cd224708n@googlegroups.com> <d58e86ab-df04-4ba4-9cdf-73020ae45e87n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d49458c0-49b6-46c9-ac7a-8da743484273n@googlegroups.com>
Subject: Re: Why does the -> operator exist ?
From: profesor...@gmail.com (fir)
Injection-Date: Wed, 09 Aug 2023 07:23:34 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: fir - Wed, 9 Aug 2023 07:23 UTC

środa, 9 sierpnia 2023 o 09:12:02 UTC+2 fir napisał(a):
> środa, 9 sierpnia 2023 o 09:08:12 UTC+2 fir napisał(a):
> > wtorek, 27 czerwca 2023 o 17:06:17 UTC+2 Bart napisał(a):
> > > On 27/06/2023 10:12, Spiros Bousbouras wrote:
> > > > I mean would it create an ambiguity if you could write s.field
> > > > both when s is a structure or union and when s is a pointer
> > > > to a structure or union ?
> > > I thought you meant why C allows P->m since it does exactly the same
> > > thing as (*P).m.
> > >
> > > From your other comment, you are asking why have a dereference between
> > > P and m at all.
> > >
> > > Actually this could have been made optional in this case:
> > >
> > > struct S* P;
> > > struct S Q;
> > >
> > > P.m + Q.m; // compiler transforms this to (*P).m + Q.m;
> > >
> > > You lose some transparency, but reduce clutter and improve readability
> > > by not having to type (*P).m or P->m.
> > >
> > allowing it for fields would be incoherent with normal pointers so if so
> > it would bebetter to skip * for all (but not for sole fields) - i was writing on this
> > some years ago...there is general problem with pointers in c imo
> >
> > here problem is rather this idiotic convention that* sticks to right (as far as i remeber
> > if i remember wrong some could correct me) in *a.b.c.d.e becouse if you would use *a.b.*c.d.e what does it mean ? a.b.c.d.**e ? * should stick immediate and then you coud write s.*p or *s.p
> > with no problem
> i dont know who set this way (thompson, ritche or someone elese?_ but its incoherent with generally c being not idioptic becouse this *a.*b.c working as i remember is idiotic

as to idea of c being explicit c uspports that idea but not in full case as its seen
for example c supports the idea being transparent (no black boxes ) bit not
necessary support the idea you can see whet some things are without refering to its definitions

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor