Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

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
raminasi
Jan 25, 2005

a last drink with no ice
ugh ok I know this is an old codebase written by scientists but how bad could it b
C code:
#include  "allocate_memory.c"
#include  "get_illuminances.c"
#include  "lightswitch.c"
#include  "analysis_data.c"

Adbot
ADBOT LOVES YOU

fritz
Jul 26, 2003

GrumpyDoctor posted:

ugh ok I know this is an old codebase written by scientists but how bad could it b
C code:
#include  "allocate_memory.c"
#include  "get_illuminances.c"
#include  "lightswitch.c"
#include  "analysis_data.c"

What, you'd rather they all be in the same file?

FlapYoJacks
Feb 12, 2009

GrumpyDoctor posted:

ugh ok I know this is an old codebase written by scientists but how bad could it b
C code:
#include  "allocate_memory.c"
#include  "get_illuminances.c"
#include  "lightswitch.c"
#include  "analysis_data.c"

Sweet jesus. :stare:

fritz posted:

What, you'd rather they all be in the same file?


Those aren't header files.

loinburger
Jul 10, 2004
Sweet Sauce Jones

Hughlander posted:

How were the sysadmins in the story well informed?

I think he meant the programmer who wanted me to read a big rear end book. I don't doubt that he knew more about Git than I do, but he did a terrible job of convincing me or anybody else on the team that we should give a poo poo.

Monkey Fury
Jul 10, 2001

LeftistMuslimObama posted:

They have a specific "curriculum" for employees who want to transfer to software development and won't pay for classes outside that. They also won't approve you to leave work to attend classes not on that curriculum. I don't believe they consulted anyone from the University when designing this curriculum, and the CEO has a Master's in math and is nearly 80 so I think she just has no clue that people can get into/enjoy programming without being huge math geniuses.
My work is a bizarre little bubble of parallel reality a lot of the time. We're also destroying all of our competitors, so it's dreadfully unlikely that anyone's going to reexamine any of the more whacky choices any time soon.

Looking forward to the coming MUMPS horrors you'll be posting

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

quote:

The owner of the [Git] repo wants everyone committed into master, and then he merges/branches from there.

I just had to explain that the repo owner wants a centralized version control system.

When I talk about Git cargo-culting, this is exactly what I mean. People switch to Git without actually understanding what it is, how to use it, or whether it will help them.

:argh:

fritz
Jul 26, 2003

ratbert90 posted:

Those aren't header files.

Yeah, I noticed. In a more perfect world, they'd be in different translation units and compiled separately, etcetcetc, but good luck getting there from here.

FlapYoJacks
Feb 12, 2009

fritz posted:

Yeah, I noticed. In a more perfect world, they'd be in different translation units and compiled separately, etcetcetc, but good luck getting there from here.

or you compile them using a makefile? There is absolutely no reason to include other C files.

xzzy
Mar 5, 2009

Pfft, makefile. You know that project was built with a shell script.

And instead of using gcc -o, they used a mv command to rename a.out.

Zopotantor
Feb 24, 2013

...und ist er drin dann lassen wir ihn niemals wieder raus...

ChickenWing posted:

variable goes on the left aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa :psyboom:

Something like this is legal in C :pervert:
code:
int fart[42];
23[fart] = butt;

FlapYoJacks
Feb 12, 2009

xzzy posted:

Pfft, makefile. You know that project was built with a shell script.

And instead of using gcc -o, they used a mv command to rename a.out.

Which in itself is a coding horror. My friends coding professor didn't know about -o either. :smith:

Space Kablooey
May 6, 2009


Zopotantor posted:

Something like this is legal in C :pervert:
code:
int fart[42];
23[fart] = butt;

:stare:

What's happening there?

IT BEGINS
Jan 15, 2009

I don't know how to make analogies

HardDisk posted:

:stare:

What's happening there?

Declaring an int array of size 42, then assigning 'butt' to the 23rd element I think. IIRC, array elements can be pointed to in reverse, so 23[fart] and fart[23] are the same memory location.

Zopotantor
Feb 24, 2013

...und ist er drin dann lassen wir ihn niemals wieder raus...

HardDisk posted:

:stare:

What's happening there?

C array notation is mostly syntactic sugar. The following two expressions are defined to have identical meanings:
code:
x[y]
*(x+y)
Since addition is commutative, so is array element access.

Beamed
Nov 26, 2010

Then you have a responsibility that no man has ever faced. You have your fear which could become reality, and you have Godzilla, which is reality.


K&R outright states t's possible, but says it's dumb to do for readability reasons.

Meat Beat Agent
Aug 5, 2007

felonious assault with a sproinging boner
I've done

code:
char c = foo["abcdefg123456789"];
for various reasons before but outside of indexing string literals it's kind of a useless trick

Nude
Nov 16, 2014

I have no idea what I'm doing.

Zopotantor posted:

Something like this is legal in C :pervert:
code:
int fart[42];
23[fart] = butt;

Not a coding horror really, but this reminded me of the 500byte rouge like code. Here's the compressed version which I guess you could say is a coding/reading horror. He only uses variables with one letter to save bytes lol.

code:
#include<stdlib.h>
#define F(n)for(j=0;j<n;j++)
#define r rand()
int main(){int x,s=46,n,i,j,z=77,l[z];char m[z*s],h[z];initscr();raw();F(z*s)j[
m]=35;F(s)for(j[l]=i=(r%4+3)*z+(n=r%17*z+r%s+z);n<=i;n+=z)for(x=n;x<=n+j/2;m[++
x]=s);F(9)l[j][m]=z,j[h]=2;m[*l]=64;*h=5;l[j][m]=62;F(z){x=n=l[i++,i%=9];if(i)!
i[h]||*l^(n+=r%3+r%3*z+~z)||--*h?0:abort();else{F(25)mvaddnstr(j,i,m+j*z,z);j=s
-getch();m[n+=j/3*z-j%3+153]^62||main();F(9)l[j+1]^n||--h[j+1]||n[m]--;}n[m]^s
||(m[l[i]=n]=x[m],x[m]=s);}}

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
I'm going to blow your mind, Nude:

http://codegolf.stackexchange.com

Zemyla
Aug 6, 2008

I'll take her off your hands. Pleasure doing business with you!

GrumpyDoctor posted:

ugh ok I know this is an old codebase written by scientists but how bad could it b
C code:
#include  "allocate_memory.c"
#include  "get_illuminances.c"
#include  "lightswitch.c"
#include  "analysis_data.c"

Is that from an embedded compiler that can't handle linking?

pseudorandom name
May 6, 2007

Or a poor compiler's whole program optimization.

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

Monkey Fury posted:

Looking forward to the coming MUMPS horrors you'll be posting

All the good stuff is way too hard to anonymize, sadly. I can say that we have a 20 year old function with 4 lines of code, and nobody knows what it does, but we can't get rid of it because it assumes about 20 variables ad sets about 20 more that are assumed elsewhere, and there's not a great way to trace what it's breaking since it was written before MUMPS had parameters for subroutines or explicit declaration of variables.

linusBorlaug
Aug 1, 2013
No, I didn't change this at all.

code:
 <cfset attributes=returnattributes(attributes="#attributes#")> 

raminasi
Jan 25, 2005

a last drink with no ice

xzzy posted:

Pfft, makefile. You know that project was built with a shell script.

And instead of using gcc -o, they used a mv command to rename a.out.

It actually uses pretty normal-looking makefiles!

Zemyla posted:

Is that from an embedded compiler that can't handle linking?

That invoke gcc! I don't know what brought about these particular includes.

This codebase also has the extremely rare quintuple pointer:
C code:
int *****direct_sun;

Sedro
Dec 31, 2008

GrumpyDoctor posted:

This codebase also has the extremely rare quintuple pointer:
C code:
int *****direct_sun;
Your job must suck if you need to run a profanity filter on your codebase

xzzy
Mar 5, 2009

To be fair, have you ever actually seen the direct_sun? gently caress it's bright, I'm going back into my basement.

comedyblissoption
Mar 15, 2006

GrumpyDoctor posted:

It actually uses pretty normal-looking makefiles!


That invoke gcc! I don't know what brought about these particular includes.

This codebase also has the extremely rare quintuple pointer:
C code:
int *****direct_sun;
I have only heard tale of the fabled 5-star programmer...

TheresaJayne
Jul 1, 2011

Slash posted:

No one thought this.

Quote from a newspaper

Computers, advancing their clocks into the double-zero abyss of the new millennium, will plunge us into chaos. Power grids will fail, elevators will crash and pacemakers will stop midbeat.

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

GrumpyDoctor posted:

This codebase also has the extremely rare quintuple pointer:
C code:

int *****direct_sun;

Actually, ***** is quite indirect :smug:

omeg
Sep 3, 2012

ratbert90 posted:

or you compile them using a makefile? There is absolutely no reason to include other C files.

Old MS driver development kits require that all files for a projects are in the same directory. Good luck if you want to share sources between projects, make a static lib or die!

Hiowf
Jun 28, 2013

We don't do .DOC in my cave.

GrumpyDoctor posted:

This codebase also has the extremely rare quintuple pointer:
C code:
int *****direct_sun;

I ag'ed all of our repos and I'm happy to say I got no hits on this "beauty".

Someone seems to be dynamically allocating 3-dimensional arrays, though.

o.m. 94
Nov 23, 2009

Skuto posted:

Someone seems to be dynamically allocating 3-dimensional arrays, though.

Apologies in advance, I'm still getting to grips with non-GC'd languages - isn't dynamically allocating a large structure like a 3-dim array the right way to do things?

Soricidus
Oct 21, 2010
freedom-hating statist shill

omeg posted:

Old MS driver development kits require that all files for a projects are in the same directory. Good luck if you want to share sources between projects, make a static lib or die!

Of course this would only be a problem on Windows anyway, due to the lack of symlinks.

Hiowf
Jun 28, 2013

We don't do .DOC in my cave.

o.m. 94 posted:

Apologies in advance, I'm still getting to grips with non-GC'd languages - isn't dynamically allocating a large structure like a 3-dim array the right way to do things?

Yes...and no.

Because of how C works, allocating multidimensional arrays dynamically quickly leads to the ****p thing.

However, note that your computer doesn't *actually* have multidimensional memory. If the subarrays aren't changing in size during the lifetime of the array, then you can just as well allocate a regular array and do the indexing yourself.

If some of the last dimensions are small, there's significant benefits to doing so.

down with slavery
Dec 23, 2013
STOP QUOTING MY POSTS SO PEOPLE THAT AREN'T IDIOTS DON'T HAVE TO READ MY FUCKING TERRIBLE OPINIONS THANKS

TheresaJayne posted:

Quote from a newspaper

Computers, advancing their clocks into the double-zero abyss of the new millennium, will plunge us into chaos. Power grids will fail, elevators will crash and pacemakers will stop midbeat.

Specifically, an article talking about how people are overplaying the "myth" of a Y2K apocalypse

http://www.newsweek.com/why-do-we-buy-myth-y2k-166590

Slash
Apr 7, 2011

TheresaJayne posted:

Quote from a newspaper

Computers, advancing their clocks into the double-zero abyss of the new millennium, will plunge us into chaos. Power grids will fail, elevators will crash and pacemakers will stop midbeat.

Which has gently caress all to say about "Thinking they hadn't been invented", which was your original point.

Space Kablooey
May 6, 2009


Zopotantor posted:

C array notation is mostly syntactic sugar. The following two expressions are defined to have identical meanings:
code:
x[y]
*(x+y)
Since addition is commutative, so is array element access.

It's cool that it works, but drat, it's ugly.

Polio Vax Scene
Apr 5, 2009



GrumpyDoctor posted:

This codebase also has the extremely rare quintuple pointer:
C code:
int *****direct_sun;

Well it's just best practice. You should never point directly at the sun.

FlapYoJacks
Feb 12, 2009

omeg posted:

Old MS driver development kits require that all files for a projects are in the same directory. Good luck if you want to share sources between projects, make a static lib or die!

No symlinks no problems. :smug:

Nude
Nov 16, 2014

I have no idea what I'm doing.

Thanks for showing me this, very cool stuff.

Adbot
ADBOT LOVES YOU

omeg
Sep 3, 2012

Soricidus posted:

Of course this would only be a problem on Windows anyway, due to the lack of symlinks.

ratbert90 posted:

No symlinks no problems. :smug:

NTFS supports symlinks and hardlinks :v:

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