Thread 105730121 - /g/ [Archived: 664 hours ago]

Anonymous
6/28/2025, 5:43:42 AM No.105730121
C
C
md5: bf9722f2d6f99a1ec7a66998287ea1e7🔍
const char const * const post = "Why are C type declarations so stupid?";
Replies: >>105730164 >>105730396 >>105731067 >>105731142 >>105732189 >>105734299 >>105734394 >>105735737 >>105736009 >>105736096 >>105737002 >>105739764
Anonymous
6/28/2025, 5:49:19 AM No.105730164
>>105730121 (OP)
> rust tranny flamewar thread #4983459839845
nobody cares, permanently unemployed rust tranny. kill yourself, thanks.
Anonymous
6/28/2025, 6:02:05 AM No.105730254
In Rust it's just
let post = "Why are C type declarations so stupid?";
Replies: >>105735737
Anonymous
6/28/2025, 6:09:39 AM No.105730286
I stopped caring since I don't have to use it beyond porting from it.
Anonymous
6/28/2025, 6:28:30 AM No.105730396
>>105730121 (OP)
literally no one writes code like this retard
Replies: >>105734299
Anonymous
6/28/2025, 7:54:52 AM No.105730936
Meanwhile -std=gnu23 chads:
auto post = "works on my machine";
Anonymous
6/28/2025, 8:25:33 AM No.105731067
1742040559156791
1742040559156791
md5: a45fc176de796fa3479cd3fbb9bfc366🔍
>>105730121 (OP)
D doesn't have this problem
Replies: >>105733372
Anonymous
6/28/2025, 8:42:33 AM No.105731142
>>105730121 (OP)
who taught you to do that? was it Dr Mr Durga?
go demand a refund of your tuition and ritual seppuku from whoever did that to you.
Replies: >>105734299
Anonymous
6/28/2025, 12:09:54 PM No.105732189
stare cat 1747949719122306
stare cat 1747949719122306
md5: 83f1013f7e6285b80e473d9f0cc4d5ed🔍
>>105730121 (OP)
>Why are C type declarations so stupid?
Perhaps it's not the declarations which are stupid.
Anonymous
6/28/2025, 3:23:23 PM No.105733372
>>105731067
thats because nobody uses it
Anonymous
6/28/2025, 3:36:40 PM No.105733450
Can a C greybeard explain what each const means here?
I love C but I'd just do a const w_char* post = "Why are C type declarations so comfy?";
Replies: >>105733569
Anonymous
6/28/2025, 3:51:44 PM No.105733569
>>105733450
>Can a C greybeard explain what each const means here?
what op posted is not valid c, there is at most 2 consts in a variable decl, so it should be:
const char* const post =


and its actually not that complicated. The first const char is the pointed to type, a const char. The second const after the * is for the pointer itself, it means the pointers value (what it points to) cannot be changed either.
So you cant do:
const char* const post = "1";
post = "2"; //cant reassign the pointer because its const
Replies: >>105733607 >>105733614
Anonymous
6/28/2025, 3:56:15 PM No.105733607
>>105733569
>what op posted is not valid c
duplicate const is valid
Replies: >>105733619
Anonymous
6/28/2025, 3:57:34 PM No.105733614
>>105733569
Ah, ic makes sense.
Anonymous
6/28/2025, 3:57:58 PM No.105733619
>>105733607
true but still completely redundant to put it there
Anonymous
6/28/2025, 4:50:34 PM No.105734143
const was a mistake
Anonymous
6/28/2025, 5:05:14 PM No.105734299
>>105730121 (OP)
>>105730396
>>105731142
>no one should write code like that anyways
Meanwhile when someone posts some javascript nonsense like
null == 0; // false
null >= 0; // true

you shit and piss yourselves over it
Replies: >>105734315 >>105734404 >>105735805
Anonymous
6/28/2025, 5:07:29 PM No.105734315
>>105734299
C standard specifies that NULL should be interpret as == 0.
Replies: >>105734360
Anonymous
6/28/2025, 5:09:42 PM No.105734334
an imutable pointer to an ummutable object on my heckin computer!??!? NO THANK YOU.
Anonymous
6/28/2025, 5:13:18 PM No.105734360
>>105734315
That has absolutely nothing to do with javascript. Not sure why you feel entitled to have an entirely separate language conform to your specification
Anonymous
6/28/2025, 5:17:13 PM No.105734394
>>105730121 (OP)
(((unsigned char)(unsigned *char))const char const * post)

myth: busted
Anonymous
6/28/2025, 5:18:38 PM No.105734404
>the fucking retard think that >>105734299 is acceptable behavior
absolute fucking retard
Anonymous
6/28/2025, 7:49:16 PM No.105735737
>>105730121 (OP)
no one uses that type

>>105730254
you can use auto in C/C++ as well
what is your point
Anonymous
6/28/2025, 7:57:12 PM No.105735805
>>105734299
because this is objectively retarded
Anonymous
6/28/2025, 8:18:01 PM No.105736009
>>105730121 (OP)
everything to the left of * is one type. so what is the type const char const?
it's exactly the same as const char. OP just added in another const to shill rust and bait people into testing if it actually compiles.
Anonymous
6/28/2025, 8:27:37 PM No.105736096
>>105730121 (OP)
This probably fucked up his c2rust translator.
You know… the thing that generates 99.99% of all rust code in existence.
Anonymous
6/28/2025, 9:52:03 PM No.105736876
void (*signal(int, void (*fp)(int)))(int);

So readable.
Replies: >>105737021
Anonymous
6/28/2025, 10:05:06 PM No.105737002
>>105730121 (OP)
remove the first const and it's perfectly clear
char const * const post = "";

modifiers on the right always affect the left, so the underlying char is const and the pointer is const
allowing modifiers to also be on the left was a mistake, there should only be one direction
Anonymous
6/28/2025, 10:06:32 PM No.105737021
>>105736876
typedef void (*signal_handler)(int);
signal_handler signal( int sig, signal_handler f);

it really is that simple.
Anonymous
6/29/2025, 1:01:59 AM No.105738164
>all these posts talking about Rust out of nowhere
Rent free lmao
Anonymous
6/29/2025, 4:38:00 AM No.105739764
>>105730121 (OP)
Because C itself is stupid. C is the enshittification of programming.