New around here? Register your SA Forums Account here!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
CPColin
Sep 9, 2003

Big ol' smile.

I know

Adbot
ADBOT LOVES YOU

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003

say it ain't so

Powerful Two-Hander
Mar 9, 2004

Mods please change my name to "Tooter Skeleton" TIA.


DELETE CASCADE posted:

say it ain't so

i will not go
turn ur monitor on
carry that printer home

dick traceroute
Feb 24, 2010

Open the pod bay doors, Hal.
Grimey Drawer

Powerful Two-Hander posted:

i will not go
turn ur screen on
carry hp home

bob dobbs is dead
Oct 8, 2017

I love peeps
Nap Ghost

ratbert90 posted:

But the wages sure have stagnated over the last 10 years!

i mean not for figgielands touchers

Aramoro
Jun 1, 2012




ratbert90 posted:

But the wages sure have stagnated over the last 10 years!

Theres a difference between being stagnat at the top of a mountain vs in a ditch at the bottom though.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
i made a thing that sends files to an external file hosting service for our client. we agreed that i upload the files to a specific directory and their process takes the files from that directory and moves them to "<numeric id>/Lahetetyt". at some point my code scans every <numeric id>/Lahetetyt directory and reassigns the files in our database to the new path. this has been in production use for almost a year and afaik, it has worked fine.

we got an email saying that it doesn't work. turns out there were a couple of problems:
the file paths are saved in a (mysql) table where the default collation makes a, ä ann å equal and there was at least 2 files that had identical file names except the first one used an "å" and the second used an "a" (my guess is that they tried to upload the one with å first and maybe it didn't work, so they renamed the file and uploaded it again). so i had to fix the collation issues there.

the second problem was that at some point the client had changed their file processing so that it moves the files to "<numeric id>/Lähetetyt" instead of "<numeric id>/Lahetetyt". this was only a problem because my code has the Lahetetyt directory hardcoded, it does not actually scan the <numeric id> directories for subdirectories. "Lähetetyt" is of course the correct way of writing the word (it means "sent"), so maybe their coder mistakenly wrote the word correctly during some maintenance.

anyway, this has been today's episode of "fun with diacritics".

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


c tp s: holy crap, the comma is a no-poo poo operator in C, not just a separator

doin this almost two decades and I had never seen or heard of that

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

Ciaphas posted:

c tp s: holy crap, the comma is a no-poo poo operator in C, not just a separator

doin this almost two decades and I had never seen or heard of that

wow. some of the examples on this page are pure :psyduck: to me

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

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Ciaphas posted:

c tp s: holy crap, the comma is a no-poo poo operator in C, not just a separator

doin this almost two decades and I had never seen or heard of that

Now try to convince yourself that this is actually serving a useful purpose.

Notorious b.s.d.
Jan 25, 2003

by Reene

Ciaphas posted:

c tp s: holy crap, the comma is a no-poo poo operator in C, not just a separator

doin this almost two decades and I had never seen or heard of that

https://www.amazon.com/Expert-Programming-Peter-van-Linden/dp/0131774298

this book will teach you things about C you never wanted to know

animist
Aug 28, 2018

ultrafilter posted:

Now try to convince yourself that this is actually serving a useful purpose.

i have never successfully done this with any software i have written

matti
Mar 31, 2019

ultrafilter posted:

Now try to convince yourself that this is actually serving a useful purpose.

1/1000 time its handy inside some ternary when the explicit statement would be less understandable

also macros

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


ultrafilter posted:

Now try to convince yourself that this is actually serving a useful purpose.

lol i'm under no fuckin illusions about that, because here's why i had to look it up

guess what, it's unnecessary pointer math dipshittery are you surprised
C code:
#define GET2(p)  ( (p)+=2, ((p)[-2]<<8) | ((p)[-1]<<0) )
now that I know what comma operator does it's not even special pointer math dipshittery, it's literally "read 2 bytes, advance pointer". gently caress's sake, whoever-wrote-this-15-plus-years-ago! :argh:

Plorkyeran
Mar 21, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
c++20 finally took the step of deprecating operator, inside subscript expressions in the hopes that a[1, 2] will someday be able to do something sensible instead

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
feels like comma came before someone figured out

#define do { ... } while (0)

also gcc and clang have ({ ... }) which is kinda useful

mystes
May 31, 2006

Plorkyeran posted:

c++20 finally took the step of deprecating operator, inside subscript expressions in the hopes that a[1, 2] will someday be able to do something sensible instead
Cool, maybe if we're still alive it will do something useful in c++72: centennial edition.

matti
Mar 31, 2019

pokeyman posted:

feels like comma came before someone figured out

#define do { ... } while (0)

also gcc and clang have ({ ... }) which is kinda useful

statement expressions are fantastic

RPATDO_LAMD
Mar 22, 2013

🐘🪠🍆

matti posted:

1/1000 time its handy inside some ternary when the explicit statement would be less understandable

also macros

ocasionally it's useful in some kind of for loop if you want to e.g. keep a low-index and a high-index that you want to update at the same time.
K&R loved these sort of doing-way-too-much-in-the-loop-condition constructs. But it's usually way more readable to just rewrite it as a while loop and do all the special crap on separate lines.

code:
void reversestr(char* str) {
  for (int low = 0, high = strlen(str) - 1; low < high; ++low, --high) {
    swapchars(str, low, high)
  }
}
or you could have something like this, if you have some kinda loop conditional that needs a line or two of setup beforehand but you want to avoid using a mid-loop break for whatever reason.

code:
Thing a;
while (a = GetNextThing(), ThingIsValid(a)) {
  Frobnicate(a);
}

matti
Mar 31, 2019

i completely forgot about for (;;); loops

they have little special parse context

i do tend to prefer goto

RPATDO_LAMD
Mar 22, 2013

🐘🪠🍆

quote:


are u hitting on me

Soricidus
Oct 20, 2010
freedom-hating statist shill

matti posted:

i completely forgot about for (;;); loops

they have little special parse context

i do tend to prefer goto

terrible programming: i do tend to prefer goto

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Ciaphas posted:

c tp s: holy crap, the comma is a no-poo poo operator in C, not just a separator

doin this almost two decades and I had never seen or heard of that

forget you ever learned so

otherwise you might start thinking about operator,() in C++

having dealt with a codebase where it was used, this is not a place of honor

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
also the comma operator in C—ignoring the C++ operator as overridden—is basically just Lisp progn

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Ciaphas posted:

lol i'm under no fuckin illusions about that, because here's why i had to look it up

guess what, it's unnecessary pointer math dipshittery are you surprised
C code:
#define GET2(p)  ( (p)+=2, ((p)[-2]<<8) | ((p)[-1]<<0) )
now that I know what comma operator does it's not even special pointer math dipshittery, it's literally "read 2 bytes, advance pointer". gently caress's sake, whoever-wrote-this-15-plus-years-ago! :argh:

but it’s actually advance pointer, read two bytes from where pointer was

Xarn
Jun 26, 2015
The comma operator on its own is ok I guess? Being useful is rare, but there are some places for it.


But did you know that you can overload it? :2bong:

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

bike shedding: why do operator definitions in c++ omit a space between the keyword "operator" and the actual operator symbol?

Xarn
Jun 26, 2015
It does not matter in the grammar, do what you want :shrug:

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
it’s their last shred of sanity begging for help

Workaday Wizard
Oct 23, 2009

by Pragmatica

NihilCredo posted:

bike shedding: why do operator definitions in c++ omit a space between the keyword "operator" and the actual operator symbol?

maybe they want to invent whitespace operators? (tabs and spaces are different operators, and vertical tab is a secret operator that enables nudality in mortal kombat if your sega genesis is connected to your pc)

TheFluff
Dec 13, 2006

FRIENDS, LISTEN TO ME
I AM A SEAGULL
OF WEALTH AND TASTE

Shinku ABOOKEN posted:

maybe they want to invent whitespace operators? (tabs and spaces are different operators, and vertical tab is a secret operator that enables nudality in mortal kombat if your sega genesis is connected to your pc)

what about U+2029 PARAGRAPH SEPARATOR

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

TheFluff posted:

what about U+2029 PARAGRAPH SEPARATOR

operatorᐸᐳ

Ciaphas
Nov 20, 2005

> BEWARE, COWARD :ovr:


operator{}() begins the song that ends the world

Asleep Style
Oct 20, 2010

Ciaphas posted:

operator{}() begins the song that ends the world

IO! IO! Cthulhu f'operator{}()'gn!

FlapYoJacks
Feb 12, 2009

by vyelkin
I sign papers on Friday for my new job and I am having an incredibly hard time even pretending to care at my current job.

PIZZA.BAT
Nov 12, 2016


:cheers:


ratbert90 posted:

I sign papers on Friday for my new job and I am having an incredibly hard time even pretending to care at my current job.

:yotj:

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

ratbert90 posted:

I sign papers on Friday for my new job and I am having an incredibly hard time even pretending to care at my current job.

same except im not going anywhere

FlapYoJacks
Feb 12, 2009

by vyelkin

Cold on a Cob posted:

same except im not going anywhere

Time to :yotj: for you as well!

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice

ratbert90 posted:

Time to :yotj: for you as well!

nah i'm actually happy with my job right now, i just can't focus at all

new project starting soon, this should help

Adbot
ADBOT LOVES YOU

Hunter2 Thompson
Feb 3, 2005

Ramrod XTreme

eschaton posted:

but it’s actually advance pointer, read two bytes from where pointer was

i think it's even worse. won't this advance the pointer by 2*sizeof(*p)?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply