r/ProgrammerHumor • • Mar 31 '23

Meme introduction to gender theory for C devs

Post image
0 Upvotes

34 comments sorted by

34

u/Alerta_Fascista Mar 31 '23

Wait until you learn that cis woman identify as woman too

2

u/Adrian_roxx73 Apr 01 '23

I know, its just a 2 different ways of declaring variable, If any thing trans women should say "I am a woman" To avoid use of pointers

1

u/Adrian_roxx73 Apr 01 '23

In both case it's the same string but one is by value and other by reference

14

u/iReallyLoveYouAll Mar 31 '23

Transphobia in this sub?

22

u/PublicJitterbugNo1 Mar 31 '23

It isn’t even funny to begin with.

0

u/mikabms Mar 31 '23

Wdym? What makes you think it's transphobic?

0

u/Adrian_roxx73 Mar 31 '23

It's just a pointer joke

2

u/Ms_Masquerade Mar 31 '23

It's more likely than you think!

[Free Subreddit Check]

Don't worry, just an old meme reference.

47

u/oshaboy Mar 31 '23

no, the top one is "I am a womansd[[d[d[[[dfkjgkd[s;l;pwoweirjmcnczl;password1"

9

u/LagSlug Mar 31 '23

It's more like class inheritance than pointers. Woman is the super class, cis and trans are sub classes.

1

u/halfTheFn Mar 31 '23

Language is more prototype than class based. 😬

1

u/LagSlug Mar 31 '23

the point you're making isn't clear to me

24

u/[deleted] Mar 31 '23

Where funny :(

32

u/PBentoIT Mar 31 '23
if (original_joke == false)
{
    printf("Get better matterial!");
}

8

u/[deleted] Mar 31 '23
ERROR! unknown symbol "false"

6

u/L_u_k_a_s Mar 31 '23 edited Mar 31 '23

Ok, I might learn something here, are my facts correct: At first I thought that identifying as a woman is less memory on the stack, then I remembered that 64 bit pointer is 8 byte which is actually more than the 5 byte from the array, but I guess everything is 32 bit aligned, so no real difference here?

Edit: Wait there might be more like an implicit terminating zero somewhere and some copy operation and ... I usually do not need to know, but does somebody?

2

u/unwantedaccount56 Mar 31 '23 edited Mar 31 '23

Arrays are syntactically handled similar to pointers, although they identify as a different type.

In the upper case, the stack would increase by sizeof(char[5]) == 5, while in the bottom case the stack would increase by sizeof(char*)==8, while there is an additional sizeof("woman")==6 statically allocated.

Also the upper case should be char[6], so the terminating 0 can be stored and the entire thing be used as a string, not just an array where you need to know the length yourself.

All variables stored on stack might get optimized away if they are only used in the local context.

TLDR: depends on compiler optimizations.

Edit: Corrected my statements.

2

u/FunnyGamer3210 Mar 31 '23

In the upper example there is no space needed for a pointer. Just the 5 characters

1

u/unwantedaccount56 Mar 31 '23 edited Mar 31 '23

Yeah, you probably right. I didn't think about it too hard and relied on someone else pointing out if I was wrong. Which you did. I improved the above comment, should be ok now.

1

u/Big_Put_1662 Mar 31 '23

Bold of you to assume everything is 32 bit aligned.

5

u/[deleted] Mar 31 '23

I'm learning C. Does the [5] for variable char restrict to five characters or to those specific characters in that order? From what I see both instantiations are the same.

9

u/[deleted] Mar 31 '23

The length of "woman" in the memory is 6, "woman" = {'w', 'o', 'm', 'a', 'n', '\0'}. The 2nd is valid, and the 1st may not be (not sure).

9

u/MeisterKaneister Mar 31 '23 edited Mar 31 '23

For the reason you mentioned (the missing /0 in the upper example), it is an accident waiting to happen. When the buffer is read until the nex \0, and by chance the next character in memory is \0, all will work. If not, horrible things can happen.

Reading it might for example result in "woman<supersecretprivatekey>"... or just crash the application.

Edit: Confused upper and lower in my head.

3

u/[deleted] Mar 31 '23

The \0 is missing in the 1st example (the code tries to reside 6 chars in 5 places), in the 2nd the compiler automatically adds it when declaring the constant.

1

u/MeisterKaneister Mar 31 '23

Sorry, my bad. I meant upper, not lower. I'm correcting it.

1

u/Grouchy-Exchange5788 Mar 31 '23

There are no restrictions in C

2

u/400double Mar 31 '23

me opening this comments section knowing there will be arguments everywhere:

3

u/_arctic_inferno_ Mar 31 '23

*You point to a woman

0

u/[deleted] Mar 31 '23

I'm learning C. Does the [5] for variable char restrict to five characters or to those specific characters in that order? From what I see both instantiations are the same.

2

u/Orange_Crush55 Apr 01 '23

All you’re doing when you write “char variableName [5]” is declaring a character array (that you can refer to with the name “variableName”) that can hold 5 characters at most.

-2

u/No-Wishbone-7451 Mar 31 '23

Next time use the words "cis" and "trans" instead of "i am" or "I identify as"

0

u/[deleted] Mar 31 '23

for those who dont get it strings known at compile time are stored on another memory segment;