Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C

Name: Anonymous 2025-03-09 1:02

https://netradiant.gitlab.io/post/2017-07-10-pk3dir-dpkdir/
would have done an if chain myself , to avoid a for loop for... 4...? 3 elements?


char pkgsomething = 'pk3';
char pkgsomething2 = 'dvksoaap';
char pkgsomething3 = 'pk77';

if (bla == pkgsomething) {
stuff;
s = 1;
} else if (!s && bla == pkgsomething2) {
stuff;
s = 1;
} else if (!s && bla == pkgsomething3) {
stuff;
s = 1;
}


#The original code was
#if (bla == pkgsomething) {
# stuff;
# s = 1;
#}


No I do not think you should "risk" a for loop for 3 unchanging elements.

Name: Anonymous 2025-03-09 1:03

I know you trans fucking faggots and feminist cunts will have a problem with that;
But you faggots also use switch statements for non-sequential non-intergers.

Name: Anonymous 2025-03-09 1:07

#Anime style would also work fine:
if (bla == pkgsomething) {
stuff;
s = 1;
}

if (!s && bla == pkgsomething2) {
stuff;
s = 1;
}

if (!s && bla == pkgsomething3) {
stuff;
s = 1;
}

That's cleaner, as it doesn't suggest that s is unreachable
(though s was defined somewhere above this bloc level)

#BUT NOO U HAVE TO HAVE AN IF ELSIF OR YOU ARE YANDERECHAN!

s is set if a fake package is used,
and that code will work on all platforms and compilers.
While .. the else if might be optimized away and have unknown compiler specific implementations.

Name: Anonymous 2025-03-09 1:13

on some compilers and some optimization levels the s might not be seen as changed by the same-level bloc.

Name: Anonymous 2025-03-09 1:13

Name: Anonymous 2025-03-09 1:14

This:
const char* cur_ext = pak_ext;
if ( strcasecmp( ext, cur_ext ) == 0 ) {
is_pak = TRUE;
}
cur_ext = g_strconcat(cur_ext, pakdir_suf, NULL);
if ( strcasecmp( ext, cur_ext ) == 0 ) {
is_pak = TRUE;


Was changed to:
for ( int i = 0; pak_ext_list[i] != NULL ; i++ ) {
const char* cur_ext = pak_ext_list[i];
if ( strcasecmp( ext, cur_ext ) == 0 ) {
is_pak = TRUE;
}
cur_ext = g_strconcat(cur_ext, pakdir_suf, NULL);
if ( strcasecmp( ext, cur_ext ) == 0 ) {
is_pak = TRUE;
}

Name: Anonymous 2025-03-09 1:17

(note I see they are not following ISOC90)

Name: Anonymous 2025-03-09 1:26

const char* pak_ext = ".pk3";
const char* pak2_ext = ".dvks";
const char* pak3_ext = ".pk77";
I'd rather do something like this,
const char* cur_ext = pak_ext;
if ( strcasecmp( ext, cur_ext ) == 0 ) {
is_pak = TRUE;
}

cur_ext = g_strconcat(cur_ext, pakdir_suf, NULL);
if ( strcasecmp( ext, cur_ext ) == 0 ) {
is_pak = TRUE;
}
//Note: since cur_ext was changed even though it's a const,
//This sets the pattern

//Other additional package "formats" for no particular reason
if (!is_pak) {
cur_ext = pak2_ext;
if ( strcasecmp( ext, cur_ext ) == 0 ) {
is_pak = TRUE;
}

cur_ext = g_strconcat(cur_ext, pakdir_suf, NULL);
if ( strcasecmp( ext, cur_ext ) == 0 ) {
is_pak = TRUE;
}
}

//Other additional package "formats" for no particular reason
if (!is_pak) {
cur_ext = pak3_ext;
if ( strcasecmp( ext, cur_ext ) == 0 ) {
is_pak = TRUE;
}

cur_ext = g_strconcat(cur_ext, pakdir_suf, NULL);
if ( strcasecmp( ext, cur_ext ) == 0 ) {
is_pak = TRUE;
}
}

Name: Anonymous 2025-03-09 1:28

Yes it uses "more code" and "boilerplate"
But it doesn't run a for loop for almost no reason for just 2 more extension "types"
Which are all zip files anyway.

It's not like these are added frequently.
Nor is this a dynamic list of supported formats?
So why not set it in stone.

Why risk a for loop running away for no fucking reason?
If the counter bit is changed in ram you have a runaway

Name: Anonymous 2025-03-09 9:41

Since almost all will be pk3 and some pk3dir
add a check around the other pack code block totally to check if we allready are a pak
this will almost always be true, thus skipping the seldom used code.
Only will be run when it's one of the new weird gay paks

if (!is_pak) {
//all that stuff past the first 2

}

Name: Anonymous 2025-03-12 21:12

if it ain't lisp its crap

Name: Anonymous 2025-03-18 13:10

>>11
RMS wrote the gnu C compiler, retard.
So try again fucking idiot fake.

Name: Anonymous 2025-03-23 19:28

>>10-12
HAX MY ANUS!!!!!!!!!!!!!!!!!!!!!! u mad? u so mad mad fuck anus mad
u madder one multiple but more???
?????
fuck u and ur ded dof

Name: Anonymous 2025-03-31 3:53

>13
is the last numerical age a girl should be married off at.
It's too late by then anyway.
Fat fucking cunt bitches.

It's a bad deal by then anyway.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List