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
Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.
Not having -Wall be the default is also a horror. Well, maybe "horror" is a little strong, so how about "questionable."

Adbot
ADBOT LOVES YOU

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"
Where I work, none of the builds use -Wall because "it prints too much noise".

Then they go and do stupid poo poo like (guess what happens when input is "-10"):
code:
bool verifyParams(int foo, int bar) {
  if(foo < 2) { ... }
  if(bar < 2) { ... }
}

bool parseParams(string& input) {
  unsigned int foo, bar;
  stringstream in(input);
  in >> foo >> bar;
  return verifyParams(foo, bar);
}

MrMoo
Sep 14, 2000

Janin posted:

Where I work, none of the builds use -Wall because "it prints too much noise".
Conversely I use the following because -Wall is too quiet,

-Wall -Wextra -Wfloat-equal -Wshadow -Wunsafe-loop-optimizations -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wnested-externs -Winline -pedantic

If you want really noisy output try the ICC compiler, warnings 981 "operands are evaluated in unspecified order" and 2259 "non-pointer conversion from "*" to "*" may lose significant bits" are crazy.

fritz
Jul 26, 2003

insure++ warns (warned?) about not saving the return value from printf

MrMoo
Sep 14, 2000

fritz posted:

insure++ warns (warned?) about not saving the return value from printf

That's where you end up with all the lazy developers doing inane hacks like void casting returns:
code:
(void)printf ("moo moo moo");
I've also seen many build scripts redirect warnings to /dev/null :haw:

BigRedDot
Mar 6, 2008

Janin posted:

Where I work, none of the builds use -Wall because "it prints too much noise".
This is true for most of our code as well. By the way we write software for submarines.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

BigRedDot posted:

This is true for most of our code as well. By the way we write software for submarines.

Get a Buildbot and a person who hates the color orange and gradually add -Whatever options to the Buildbot.

Zombywuf
Mar 29, 2008

Avenging Dentist posted:

Get a Buildbot and a person who hates the color orange and gradually add -Whatever options to the Buildbot.

Or simply automate a process to collect the warnings, svn blame to get the developer from the file and line number and email them the relevant lines from the error log.

Bonus points for one email per line with a warning.

BigRedDot
Mar 6, 2008

Avenging Dentist posted:

Get a Buildbot and a person who hates the color orange and gradually add -Whatever options to the Buildbot.
Would that I could. Our three-sided wheel, homespun, messy perl-script build system is a horror unto itself. Why yes, it is named after the person who wrote it.

Edit: zombywuf I want to hug you

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
There is literally no reason you can't use Buildbot, since fundamentally, it just runs shell commands.

Zombywuf
Mar 29, 2008

Avenging Dentist posted:

There is literally no reason you can't use Buildbot, since fundamentally, it just runs shell commands.

You'd be amazed how unmanageably complicated people can make build systems. There is a tendency to reduce the build process to a single command which either returns yes or no, and then unwind that whole process to get at error messages while keeping it exactly the same.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

BigRedDot posted:

This is true for most of our code as well. By the way we write software for submarines.

High-five "terrible standards for important software" buddy! I always find it amusing that open-source developers have long arguments about whether to use -Werror or not, when companies with millions of dollars to lose are like "gently caress it, if it doesn't crash more than once an hour or so, ship!".

Zombywuf posted:

Or simply automate a process to collect the warnings, svn blame to get the developer from the file and line number and email them the relevant lines from the error log.

Hah, I wish we were using anything as sane as Subversion. Our VCS has no CLI; its only interface is graphical, written in Java Swing, and uses over 200 MiB RAM (from a 1 GiB VM) when idle.

The VM is another funny thing. Everything we do -- editors, builds, the final product -- runs on Linux. But IT wants to keep Windows on the computers. So every developer has installed Linux in a VM and usually just keeps it full-screen all day.

Zombywuf posted:

Bonus points for one email per line with a warning.

*does this*
*gets fired for crashing the email server*

dancavallaro
Sep 10, 2006
My title sucks
Sooooo anyone ever use Xilinx ISE?

Athas
Aug 6, 2007

fuck that joker

Janin posted:

Hah, I wish we were using anything as sane as Subversion. Our VCS has no CLI; its only interface is graphical, written in Java Swing, and uses over 200 MiB RAM (from a 1 GiB VM) when idle.

What is the name of this horror? It sounds unbelievable.

Stories like these make me glad to be in academia. Do people set up incredibly awful things? Sure, but they normally can't force you to do the same.

Zombywuf
Mar 29, 2008

Janin posted:

Hah, I wish we were using anything as sane as Subversion. Our VCS has no CLI; its only interface is graphical, written in Java Swing, and uses over 200 MiB RAM (from a 1 GiB VM) when idle.

All Java programs do this.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Athas posted:

What is the name of this horror? It sounds unbelievable.

Stories like these make me glad to be in academia. Do people set up incredibly awful things? Sure, but they normally can't force you to do the same.

I don't want to name it 'cause it might show up in Google; not many companies use it, obviously. It's owned by IBM, isn't ClearCase, and has a Wikipedia page.

Lexical Unit
Sep 16, 2003

Zombywuf posted:

Or simply automate a process to collect the warnings, svn blame to get the developer from the file and line number and email them the relevant lines from the error log.

Bonus points for one email per line with a warning.

I work with BigRedDot, and I have emailed people about warnings and bugs before. Never has an email I sent out about a bug or warning resulted in the bug or warning being fixed. And every time I've fixed a bug or warning in a library I didn't initially write, it's caused my boss to respond with, "you shouldn't be wasting your time with that. Don't compile with -Wall. If the warning isn't on by default then just ignore it."

My boss is the guy who created our build system.

Features of our build system:

  • Dependancies expressed as symlinks or directories (it doesn't distinguish).
  • Only one main() function allowed per directory.
  • Your current directory is your target executable and has the same name as your directory.
  • Each subdirectory (including symlinks) become an individual library named "lib" + directory name + ".a"
  • Directories containing a _ignore file are ignored.
  • Written in mishmash of perl/bash and pre-made Makefiles.
  • The only way to have different behavior is to create a _override file that is-a Makefile that gets concatenated to the end of the generated Makefile.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

Lexical Unit posted:

Features of our build system:

Could be worse. You could be using autotools.

Parantumaton
Jan 29, 2009


The OnLy ThInG
i LoVe MoRe
ThAn ChUgGiNg SeMeN
iS gEtTiNg PaId To Be A
sOcIaL MeDiA sHiLl
FoR mIcRoSoFt
AnD nOkIa

Zombywuf posted:

All Java programs do this.

Swing apps do, ours start at 24 megs (that's a lot too, agreed) and never pass 300 megs. Then again, our Java apps don't plain suck as apparently a lot of others' do...

BigRedDot
Mar 6, 2008

Avenging Dentist posted:

Could be worse. You could be using autotools.
I've used autotools, so I know just how much it sucks. I can state without hesitation that this home-grown abortion is worse. My own preference would be cmake, but if the choice was autotools or what we have now I would switch in a heartbeat. Just to give you an idea: in order to have a "local" configuration that gets built here in our limited environment, and a "production" configuration that gets built at the lead integrator's site in the full environment, every one of our entire huge trees, in every one of our many baselines, is duplicated in its entirety, so that basically a symlink can change. Make sure you only, only ever pull from prod to local! Never the other way! No, really, not joking.

BigRedDot fucked around with this message at 19:41 on Feb 8, 2010

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Parantumaton posted:

Swing apps do, ours start at 24 megs (that's a lot too, agreed) and never pass 300 megs. Then again, our Java apps don't plain suck as apparently a lot of others' do...

24 megs is nothing, 300 megs could be a problem on a low-end machine.

Zombywuf
Mar 29, 2008

Wheany posted:

24 megs is nothing, 300 megs could be a problem on a low-end machine.

Depends if all the programs on your system think 24MB is nothing.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Zombywuf posted:

Depends if all the programs on your system think 24MB is nothing.

Well, if every background process and service running on this machine would take 24MB, I would be at about 1,5 GB. It would not be pleasant, since this machine only has a gig of RAM.

Then again, computers with 2 GB RAM is not exactly rare these days.

zootm
Aug 8, 2006

We used to be better friends.
Edit: Replied to Zombywuf without realising.

markerstore
Dec 5, 2003
Canny!

Wheany posted:

Well, if every background process and service running on this machine would take 24MB, I would be at about 1,5 GB. It would not be pleasant, since this machine only has a gig of RAM.

Then again, computers with 2 GB RAM is not exactly rare these days.

If only there were some way to temporarily store the contents of RAM on your hard drive while they weren't being used!

Pardot
Jul 25, 2001




markerstore posted:

If only there were some way to temporarily store the contents of RAM on your hard drive while they weren't being used!

But there is, and you know there is :colbert:

POKEMAN SAM
Jul 8, 2004

Pardot posted:

But there is, and you know there is :colbert:

Hey some of us don't have your crazy GIGABYTE drives installed. I'm working on a machine with 4GB RAM and only 640MB disk drive. :awesome:

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

markerstore posted:

If only there were some way to temporarily store the contents of RAM on your hard drive while they weren't being used!

Like I said: "It would not be pleasant, since this machine only has a gig of RAM." And besides, I was the one arguing that 24MB is nothing.

Zombywuf
Mar 29, 2008

markerstore posted:

If only there were some way to temporarily store the contents of RAM on your hard drive while they weren't being used!

I think there is a way of doing that, I believe the mechanism is called thrashing.

Parantumaton
Jan 29, 2009


The OnLy ThInG
i LoVe MoRe
ThAn ChUgGiNg SeMeN
iS gEtTiNg PaId To Be A
sOcIaL MeDiA sHiLl
FoR mIcRoSoFt
AnD nOkIa

Wheany posted:

24 megs is nothing, 300 megs could be a problem on a low-end machine.

Our software supports millions of users per day and are generally run on clustered servers (mostly because clients demand it) so 300 megs is nothing to us.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Parantumaton posted:

Our software supports millions of users per day and are generally run on clustered servers (mostly because clients demand it) so 300 megs is nothing to us.

I just took a look at a price watch site and listed their computers by price. The cheapest computers were nettops that had 1 GB of memory. There was one thin client that had 512MB, and a bunch of "media" computers that also had 1 GB.

Pretty much any "real" desktops these days come with 2GB, often 3 or 4 gigs.

I'd say memory usage on software designed for a desktop computer (or higher) is not that big of a worry these days. Memory leaks are of course a different matter.

e: (I'm not disagreeing with you.)

Bozart
Oct 28, 2006

Give me the finger.
Probably already been seen, but at work I ran into:

true = 1; false = 2;

admittedly it was to be able to use matrix math, and the labels didn't mean anything. But in matlab they're keywords.

Standish
May 21, 2001

The Coverity guys have seen more bad code than anyone

quote:

Upon seeing an error report saying the following loop body was dead code
code:
for (i=1; i<0;i++)
...dead code
""No, that's a false positive; a loop executes at least once."

quote:

a buffer overflow checker flagged a bunch of errors of the form
code:
unsigned p[4];
p[4]=42;
"No, ANSI lets you write 1 past the end of the array." (After heated argument, the programmer said, "We'll have to agree to disagree.")

quote:

the following in the X Window System:
code:
if (getuid()!=0 && geteuid ==0)
{
  ErrorF("only root");
  exit(1);
}
It allowed any local user to get root access and generated enormous press coverage, including a mention on Fox news

ZorbaTHut
May 5, 2005

wake me when the world is saved

Bozart posted:

Probably already been seen, but at work I ran into:

true = 1; false = 2;

admittedly it was to be able to use matrix math, and the labels didn't mean anything. But in matlab they're keywords.

I was working with an annoying C library a while back that defined its own FALSE and TRUE constants. I wanted to use those names on my own, so I ended up with

code:
#ifndef TRUE
#define TRUE 1
#endif
Then I copy-pasted it for FALSE. Except I forgot to change the 1 to a 0.

That one took me a while to find, let me tell you.

tef
May 30, 2004

-> some l-system crap ->

Bozart posted:

Probably already been seen, but at work I ran into:

true = 1; false = 2;

In visual basic, true = -1 and false = 0 :3:

mr_jim
Oct 30, 2006

OUT OF THE DARK

tef posted:

In visual basic, true = -1 and false = 0 :3:

A lot of Forths are the same way.

Zombywuf
Mar 29, 2008

tef posted:

In visual basic, true = -1 and false = 0 :3:

#define TRUE ~0

BigRedDot
Mar 6, 2008

ZorbaTHut posted:

I was working with an annoying C library a while back that defined its own FALSE and TRUE constants. I wanted to use those names on my own, so I ended up with

code:
#ifndef TRUE
#define TRUE 1
#endif
Then I copy-pasted it for FALSE. Except I forgot to change the 1 to a 0.

That one took me a while to find, let me tell you.
LOL I am reminded of the old, but still humorous How to Write Unmaintainable Code

quote:

Another technique is to make TRUE and FALSE have the same value, though most would consider that out and out cheating. Using values 1 and 2 or -1 and 0 is a more subtle way to trip people up and still look respectable.

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"
Honestly modern languages are pretty wasteful defining FALSE as 0 and TRUE as 1. The smallest addressable unit you have to work with is a byte, so you've got at least seven other bits just sitting there, empty and wasted. You could do the ol' FALSE = 0 and TRUE = ~0 trick, but then if your Boolean values aren't evenly distributed, your computer's memory runs the risk of being way too light or way too heavy, and that's not good for the hardware. Or for anybody.

So really the best way is to define FALSE=0xAAAAAAAA and TRUE=0x55555555 (adjusted to the natural word length of the processor, of course). Then FALSE = ~TRUE still holds, but more importantly your Boolean values are nicely balanced with an equal number of set and clear bits.

It's the yin and the yang, man. Groovy.

Adbot
ADBOT LOVES YOU

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"
:psyboom:

code:
fstream file_stream(file_path.c_str());
stringstream file_xml;
while (file_stream) {
  string line;
  getline(file_stream, line);
  file_xml << line << "\n";
}

stringstream rm_cmd;
rm_cmd << "rm -f " << file_path;
system(rm_cmd.str().c_str());

string xml = file_xml.str();

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