News for hackers. Stuff that matters.
Re:C uses "&" for the address-operator because 'ampersand so... by robertlagrant on Tuesday October 10, 2023 @07:29AM (#37830789)
Hot take: @ might've been a good alternative.
Re:C uses "&" for the address-operator because 'ampersand so... by Dobbs on Tuesday October 10, 2023 @07:47AM (#37830901)
I didn't think @ took on the "at" meaning until email came around.
Re:C uses "&" for the address-operator because 'ampersand so... by johannes1234321 on Tuesday October 10, 2023 @08:06AM (#37831028)
The oldest trace of @ being used to mean "at" can be traced to typeriters for commerce around 1880, where it was used as "5 apples @ 10 p" meaning "5 apples at 10 pence each."

At least that's what German Wikipedia Claims while the corresponding paragraph in english Wikipedia is short.

https://de.wikipedia.org/wiki/At-Zeichen

https://en.wikipedia.org/wiki/At_sign

Re:C uses "&" for the address-operator because 'ampersand so... by jfk13 on Tuesday October 10, 2023 @08:11AM (#37831065)
The formal name of the Unicode character U+0040 '@' is, in fact, COMMERCIAL AT.

https://en.wikipedia.org/wiki/At_sign#Unicode

Re:C uses "&" for the address-operator because 'ampersand so... by Sanzig on Tuesday October 10, 2023 @08:44AM (#37831344)
It's also the "a commercial" in Quebec French [1]. Despite lacking the accent on the A (à), the intention of the A is to stand in for the single letter French word "à" (at) [2].

[1] https://vitrinelinguistique.oqlf.gouv.qc.ca/fiche-gdt/fiche/... [2] https://www.noslangues-ourlanguages.gc.ca/fr/cles-de-la-reda...

Re:C uses "&" for the address-operator because 'ampersand so... by gattilorenz on Tuesday October 10, 2023 @09:26AM (#37831783)
More recently (but still 1968, before email): "In ALGOL 68, the @ symbol is brief form of the at keyword; it is used to change the lower bound of an array. For example: arrayx[@88] refers to an array starting at index 88."
Re:C uses "&" for the address-operator because 'ampersand so... by d-lisp on Tuesday October 10, 2023 @02:47PM (#37835899)
French wikipedia traces the usage of @ to signify "à" (at) back to Renaissance !
Re:C uses "&" for the address-operator because 'ampersand so... by tsimionescu on Tuesday October 10, 2023 @08:29AM (#37831208)
What do you think it meant before that?
Re:C uses "&" for the address-operator because 'ampersand so... by narag on Tuesday October 10, 2023 @08:53AM (#37831430)
Re:C uses "&" for the address-operator because 'ampersand so... by syockit on Tuesday October 10, 2023 @09:06AM (#37831557)
As for me, I was taught it meant "alias", used when introducing nickname together with real name.
Re:C uses "&" for the address-operator because 'ampersand so... by eesmith on Tuesday October 10, 2023 @08:53AM (#37831434)
RFC 20 shows "@" defined as "commercial at" in 1969. https://www.rfc-editor.org/rfc/rfc20.html . That was two years before Tomlinson used it for email addressing.

EDIT: "Creation of Computer Input in an Expanded Character Set" at https://ejournals.bc.edu/index.php/ital/article/download/292... from 1968, p112, describes it simply as "at".

Re:C uses "&" for the address-operator because 'ampersand so... by aidenn0 on Tuesday October 10, 2023 @12:59PM (#37834604)
There are claims it comes from the latin "ad" similar to how & comes from the latin "et" but the etymology is far less certain, with the french à being another possible source.

What I can't find is when it was first used in the US for indicating home-team for sports. E.g. [1] where there is vs. or @ depending on whether it is a home or away game. I suspect it's relatively modern, but not sure how far back it goes.

1: https://www.mlb.com/redsox/schedule/2023-09

Re:C uses "&" for the address-operator because 'ampersand so... by tsegers on Tuesday October 10, 2023 @07:53AM (#37830931)
I'd argue @ is more suitable for a dereference operation than an "address of" one. It functions that way in an email address too.
Re:C uses "&" for the address-operator because 'ampersand so... by bsza on Tuesday October 10, 2023 @08:03AM (#37831001)
Also, then "int @p" would read "integer at p" which is exactly what "int *p" means.
Re:C uses "&" for the address-operator because 'ampersand so... by robertlagrant on Tuesday October 10, 2023 @08:40AM (#37831294)
Ah yes - that's true.
Re:C uses "&" for the address-operator because 'ampersand so... by amelius on Tuesday October 10, 2023 @09:26AM (#37831794)
So address-of could be an "@" symbol, but upside down.
Re:C uses "&" for the address-operator because 'ampersand so... by anticensor on Tuesday October 10, 2023 @02:35PM (#37835735)
Or a spanish question mark ¿.
Re:C uses "&" for the address-operator because 'ampersand so... by frou_dh on Tuesday October 10, 2023 @11:57AM (#37833837)
That's precisely what Clojure did, where @foo is syntactic sugar for (deref foo)
Re:C uses "&" for the address-operator because 'ampersand so... by elurg on Tuesday October 10, 2023 @08:43AM (#37831321)
Pascal uses this syntax.

Also "pointer to integer" is written as "^integer" which is better than "int".

Syntax also doesn't allow confusing stuff like like "int a, b;".

Re:C uses "&" for the address-operator because 'ampersand so... by brandmeyer on Tuesday October 10, 2023 @09:21AM (#37831719)
> "^integer" which is better than "int"

I agree that it reads a little better. But as a small-handed person, it is unfortunately much more uncomfortable to type.

Re:C uses "&" for the address-operator because 'ampersand so... by sureglymop on Tuesday October 10, 2023 @10:23AM (#37832510)
Honestly that fully depends on your locale and keyboard layout. So it really shouldn't influence programming language syntax design.
Re:C uses "&" for the address-operator because 'ampersand so... by bmacho on Tuesday October 10, 2023 @01:18PM (#37834797)
My computer has buttons, and characters printed on it. So I can't really change the distance between characters.
Re:C uses "&" for the address-operator because 'ampersand so... by jandrese on Tuesday October 10, 2023 @08:56AM (#37831451)
I agree, big missed opportunity in C’s development.
Re:C uses "&" for the address-operator because 'ampersand so... by jjgreen on Tuesday October 10, 2023 @09:22AM (#37831727)
Instance-variable heavy Ruby code does look rather like someone has sneezed on the monitor, so I think it would have been a bad move, aesthetically ...
Re:C uses "&" for the address-operator because 'ampersand so... by user3939382 on Tuesday October 10, 2023 @10:01AM (#37832226)
Nethack or code? You decide
Re:C uses "&" for the address-operator because 'ampersand so... by pjmlp on Tuesday October 10, 2023 @09:40AM (#37831964)
Which is what Pascal dialects use.
Re:C uses "&" for the address-operator because 'ampersand so... by JoeAltmaier on Tuesday October 10, 2023 @10:23AM (#37832505)
Yup. But as I understand it @ wasn't available on the terminals used to create C. Likewise #. They were used for later features, once they could actually be typed. Happy outcome, that there were characters available for fresh features, since C used absolutely everything available on the original (ADM?) terminals.

Another curious thing: Unix came shortly after and was entirely typed with lower case. Because those same terminals had only one font (font ROMs were tiny back then, and expensive). It looked like UPPERCASE but in fact the keyboard produced lowercase. Once better terminals were used to edit the code it was noticed for the first time(?) that it's all be edited as lowercase.

Or so the story went, back in those days, when it was all new.

Re:C uses "&" for the address-operator because 'ampersand so... by trealira on Tuesday October 10, 2023 @10:36AM (#37832675)
That corroborates what I've read.

The DEC PDP-11 assembler used the @ symbol for dereferences of registers ("@Rn" or "(Rn)" dereferenced a register, for example).

However, in Unix, the terminal convention was to use the @ symbol to delete the current line, and they didn't have a DEC assembler yet, so they used the asterisk (*) instead in B, as well as in the Unix PDP-11 assembler, which was written in B.

I'm paraphrasing this Quora post (which lists primary and secondary sources): https://www.quora.com/Why-did-the-developers-of-C-decide-to-...

Re:C uses "&" for the address-operator because 'ampersand so... by kps on Tuesday October 10, 2023 @11:25AM (#37833306)
1963 ASCII was upper-case only, and many early terminals (notably for Unix, including the Teletype 33) were upper case only. `stty lcase`, which maps upper-case input to lower case, existed early — https://www.tuhs.org/cgi-bin/utree.pl?file=V1/man/man2/stty....
Re:C uses "&" for the address-operator because 'ampersand so... by aidenn0 on Tuesday October 10, 2023 @01:20PM (#37834835)
As far as I know @ on modern keyboards above the two from the IBM Selectric[1], released in 1961; the Model D and the VT-52 both copied the keyboard layout. The 1963 ASCII draft had @, despite not having lowercase yet.

Prior to IBM, it was on at least the Underwood typewriters[2], so it was never quite absent.

1: https://en.wikipedia.org/wiki/IBM_Selectric#/media/File:IBM_... Note that the number-row is only different from modern keyboards with the cent-sign being replaced with a caret (the cent-sign was never included in ASCII)

2: https://upload.wikimedia.org/wikipedia/commons/a/a4/Ernest_H...

Re:C uses "&" for the address-operator because 'ampersand so... by mock-possum on Tuesday October 10, 2023 @12:03PM (#37833915)
My immediate thought as well.

Where’s that value in memory? It’s @ the address.

Re:C uses "&" for the address-operator because 'ampersand so... by marssaxman on Tuesday October 10, 2023 @02:25PM (#37835611)
At least a couple dialects of BASIC used @ as a shortcut for the `VarPtr` operation.
Re:C uses "&" for the address-operator because 'ampersand so... by extraduder_ire on Tuesday October 10, 2023 @08:00PM (#37839344)
At the very least, &/* are in the same place on many keyboards, I've been bitten by muscle memory many times going back and forth between us/uk/fr keyboard layouts.

For reference, it's above the ' and between the ;: and #~ keys on my current board, rather than on shift-2 (where " lives).

Maybe this would have stayed consistent worldwide, if it was used in c.