<geist>
yah it may be bar(), then just a plain foo pointer?
<ring0_starr>
6.5.17.2
<ring0_starr>
it just feels wrong though
<ring0_starr>
> The left operand of a comma operator is evaluated as a void expression; there is a
<ring0_starr>
sequence point after its evaluation.
<geist>
clang takes it but warns that the left side of the comma operator has no effect
<ring0_starr>
the syntax for the comma operator says it's expression, assignment-expression
<geist>
i guess that makes sense. (x, y, z) -> z from an expression point of view
<ring0_starr>
yeah I learned about this by looking at a macro in OpenSSL and going "WTF" for a full 5 minutes
<geist>
so (x, y, z) is, z(); x; y;
<geist>
or something
<ring0_starr>
it's like if you don't explicitly prevent something from being valid, it'll be abused in the most creative way possible
<ring0_starr>
assignment-expression is defined as: conditional-expression, or unary-expression assignment-operator assignment-expression. okay, didn't know about the first one
<geist>
i'll have to riddle roland at work tomorrow and see if he gets it on the first time
<geist>
he knows a lot of eccentric stuff in the language
<ring0_starr>
and conditional-expression is literally just a daisy chain of definitions for OR and AND expressions
<ring0_starr>
so they've somehow defined the comma operator to be basically everything by passing the buck along to another expression type
netbsduser` has quit [Ping timeout: 245 seconds]
<geist>
but yeah, (foo, bar()) seems right
<geist>
which of course actually does also work
vdamewood has quit [Quit: Life beckons]
<ring0_starr>
and i feel like the way expressions are daisy-chain defined in C is kind of an abuse of ebnf
bauen1 has joined #osdev
<ring0_starr>
just my opinion though
<ring0_starr>
expression ought to be defined top down heirarchically
Yoofie64644634 has joined #osdev
Yoofie646446349 has joined #osdev
Yoofie6464463 has quit [Ping timeout: 248 seconds]
Yoofie646446349 is now known as Yoofie6464463
Yoofie64644634 has quit [Ping timeout: 252 seconds]
Yoofie64644631 has joined #osdev
Yoofie6464463 has quit [Ping timeout: 252 seconds]
Yoofie64644631 is now known as Yoofie6464463
Jaiza has quit [Read error: Connection reset by peer]
Jaiza has joined #osdev
rorx has quit [Ping timeout: 248 seconds]
<kof673>
eh, it makes sense. (foo, bar, baz) it gets a pointer, the end result is baz in this case, then baz() is invoked. x = ( foo(), bar(), baz() ); x = ( foo, bar, baz )(); by making foo()/bar()/baz() output you can see the former calls them just fine, return value is of baz(), while the latter only calls baz()
<kof673>
(foo, bar, baz)() of course. it just does the left () first
rorx has joined #osdev
goliath has joined #osdev
<ring0_starr>
if , were the composition operator it'd look kinda mathy
<ring0_starr>
(f * g)(x) == f(g(x))
<ring0_starr>
not that I want my C to try to look like math
<kof673>
i have seen some compiler be picky about *fp fp() (*fp)() whatever but do not recall
<kof673>
had to fix code or make an ifdef
<geist>
yeah you're right. i basically never use comma operators so i always have to look it up every time
<kof673>
don't listen to me, just i think that is what is going on........
<kof673>
"you only *think* you know" i only *think* i know
<ring0_starr>
but anyway about the short identifiers bit
<ring0_starr>
creat(2)
<ring0_starr>
that's 5 chars
<ring0_starr>
> <kof673> did they purposely use short names to be cute, or was there a real reason? i don't know
<kof673>
i'm not defending it lol
<ring0_starr>
> The implementation
<ring0_starr>
may further restrict the sipniticance
<ring0_starr>
of an
<ring0_starr>
and uppercase letters are different.
<ring0_starr>
euernal name (an identifier ,that has external linkape) to six characters and may ignore
<ring0_starr>
These limitations
<ring0_starr>
on identifiers
<ring0_starr>
are all
<ring0_starr>
distinctions
<ring0_starr>
of alphabetical
<ring0_starr>
case for such names.”
<ring0_starr>
ok didn't mean to paste all those \ns
<kof673>
that's even worse lol
<ring0_starr>
the limit says 6! 6! and creat uses 5 only
<ring0_starr>
I believe one of dennis ritche's famous last words before he died were "I regret not spelling creat with an e". Literally
<kof673>
i got the 8 and 7 from filenames then...there was some filesystem that was 7.3 i believe
<kof673>
not c-related
<kof673>
probably not a real concern for that, just cat everything into one giant file or whatever and name it x.c
<ring0_starr>
woah, my pdf reader really butchered that line of text
<ring0_starr>
sip niti cance
<ring0_starr>
euernal!
Leftas has quit [Ping timeout: 252 seconds]
GeDaMo has joined #osdev
<ring0_starr>
but anyway, kof, look at UNIX System III, src/uts/pdp11/os/main.c - it has identifiers like "firstaddr" (9 chars) so clearly they can make names legible if they want to (and there's no external linkage requirement)
<kof673>
gimme a link :D i think local vars, structure names, limit is much longer........it is global variables, function names, the limit IIRC
<kof673>
or, it is really a linker somewhere why the limit was made maybe..........
<geist>
i was thinking there was some sort of issue/etc with 12 and 18 bit machines that were using 6 bit alphanumerics, and the desire to fit them in a word
the_oz has joined #osdev
<kof673>
that would make sense too........except how much C ran there?
<geist>
i know pdp-8 had 12 bit numbers so it tries to generally fit two per, though unix never ran there
<geist>
but i think pdp7 or so was one of the first, and it may have been an 18 bit machine
<geist>
in that case two words gets you 6 characters
<geist>
if using upper case only, etc
<geist>
maybe not a C thing but may have affected the design of B and then held over
<geist>
or something like 5 chars and a null (creat, open, close, etc) would fit in 2 words
<ring0_starr>
you have to talk to DMR himself before using the --o flag for ld
<kof673>
i do 7 or 8 sometimes, but .....probably only thing i will ever actually meet is whatever the pdp10 gcc toolchain uses to assemble on the tops-20 side............or there is emulator for multics now, but not exactly high priority........
<ring0_starr>
unix version 1 has identifiers longer than 8 definitely
<ring0_starr>
unfortunately it doesn't look like the source for v1's ld is available
<kof673>
i am speculating, i mean not sure i can even get my hands on a toolchain where that is an issue.....
<ring0_starr>
it would be interesting to see where that comes from
<kof673>
AFAI am concerned, it is just getting enough to write a virtual machine/scripting language/etc. and that it does not matter
<kof673>
*and then it does not matter. but a place like that, how much ram do you even have?
<ring0_starr>
idk
<ring0_starr>
interesting to note that C99 removes the specific verbiage specifying limitations on identifier lengths
<ring0_starr>
just deferring to "some implementations may be more restrictive"
<ring0_starr>
the 6 character limit is only a C90 thing, something i'd interpret as a lower bound in any implementation.
<ring0_starr>
oh actually im wrong, they just redirect you to 5.2.4.1 in C99, the 6 char hard lower bound is still there. interestingly though, it says this: "each universal character name specifying a short identifier of 0000FFFF or less is considered 6 characters" note that 0xFFFF is 0177777
Lucretia has joined #osdev
monkeyPlus has joined #osdev
msv has joined #osdev
Jaiza has quit [Ping timeout: 252 seconds]
Jaiza has joined #osdev
bauen1 has quit [Ping timeout: 246 seconds]
d1rg3_ has quit [Ping timeout: 244 seconds]
Jaiza has quit [Read error: Connection reset by peer]
Jaiza has joined #osdev
Jaiza has quit [Read error: Connection reset by peer]
Jaiza has joined #osdev
Jaiza has quit [Read error: Connection reset by peer]
gildasio has quit [Remote host closed the connection]
gildasio has joined #osdev
d1rg3_ has joined #osdev
d1rg3_ has quit [Read error: Connection reset by peer]