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
Jarl
Nov 8, 2007

So what if I'm not for the ever offended?

So true.

Adbot
ADBOT LOVES YOU

hyphz
Aug 5, 2003

Number 1 Nerd Tear Farmer 2022.

Keep it up, champ.

Also you're a skeleton warrior now. Kree.
Unlockable Ben
Can anyone tell me that Xtext isn't a horror? With something called EMF which seems to be a massive inner platform and enough weird conventions that they had to write their own Java variant to deal with the number of getClass based switches you need to write?

KernelSlanders
May 27, 2013

Rogue operating systems on occasion spread lies and rumors about me.

Eela6 posted:

Don't doxx me

(I am getting acclimated to go, but I will never forgive them not having a loving set type with intersection, union, and difference methods. What the gently caress.)

I have seen mutable data structures passed by reference to asynchronous go routines in every non-trivial go program I've interacted with.

Eela6
May 25, 2007
Shredded Hen
Don't you see? By limiting the syntax, you eliminate all the problems that come from higher-order concepts! Bing bong so simple

KernelSlanders
May 27, 2013

Rogue operating systems on occasion spread lies and rumors about me.
MIPS has a limited syntax

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

Eela6 posted:

Don't you see? By limiting the syntax, you eliminate all the problems that come from higher-order concepts! Bing bong so simple

This is why I write all my code like this https://en.m.wikipedia.org/wiki/Whitespace_(programming_language)

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

KernelSlanders posted:

MIPS has a limited syntax

And indeed MIPS is good.

comedyblissoption
Mar 15, 2006

KernelSlanders posted:

I have seen mutable data structures passed by reference to asynchronous go routines in every non-trivial go program I've interacted with.
but golang makes concurrency easy

vOv
Feb 8, 2014

comedyblissoption posted:

but golang makes concurrency easy

Hey, they never said it makes correct concurrency easy!

Dr. Stab
Sep 12, 2010
👨🏻‍⚕️🩺🔪🙀😱🙀
The thing about coding in MIPS is that there's no way any bugs will be introduced because the computer does exactly what you tell it to do with no messy compiler to screw things up for you. My MIPS code has never once thrown an exception.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Dr. Stab posted:

The thing about coding in MIPS is that there's no way any bugs will be introduced because the computer does exactly what you tell it to do with no messy compiler to screw things up for you. My MIPS code has never once thrown an exception.

I wonder if Mel Kaye would unironically agree with this post.

JawnV6
Jul 4, 2004

So hot ...
Psh, upgrade to a R4000.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
Can't decide whether I'm being a bit too pedantic, or far too pedantic.

code:
void CMyDialog::EnableButtons(bool enabled)
{
	BOOL enabled_asWindowsBOOL = enabled ? TRUE : FALSE;

	m_button1.EnableWindow(enabled_asWindowsBOOL);
	m_button2.EnableWindow(enabled_asWindowsBOOL);
	m_button3.EnableWindow(enabled_asWindowsBOOL);
}

Absurd Alhazred
Mar 27, 2010

by Athanatos

Hammerite posted:

Can't decide whether I'm being a bit too pedantic, or far too pedantic.

code:
void CMyDialog::EnableButtons(bool enabled)
{
	BOOL enabled_asWindowsBOOL = enabled ? TRUE : FALSE;

	m_button1.EnableWindow(enabled_asWindowsBOOL);
	m_button2.EnableWindow(enabled_asWindowsBOOL);
	m_button3.EnableWindow(enabled_asWindowsBOOL);
}

Might as well get a class to do this for you:

C++ code:
class WinBOOL
{
public:
	WinBOOL(bool boolean) : m_internal(boolean ? TRUE : FALSE);
	WinBOOL& operator=(bool boolean)
	{
		m_internal = boolean ? TRUE : FALSE;
		return *this;
	}
	operator BOOL() const
	{
		return m_internal;
	}
private:
	BOOL m_internal;
};

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Hammerite posted:

Can't decide whether I'm being a bit too pedantic, or far too pedantic.

code:
void CMyDialog::EnableButtons(bool enabled)
{
	BOOL enabled_asWindowsBOOL = enabled ? TRUE : FALSE;

	m_button1.EnableWindow(enabled_asWindowsBOOL);
	m_button2.EnableWindow(enabled_asWindowsBOOL);
	m_button3.EnableWindow(enabled_asWindowsBOOL);
}
Good idea, some doofus could pass in a VARIANT_TRUE and then who knows what would happen?

Nude
Nov 16, 2014

I have no idea what I'm doing.

Absurd Alhazred posted:

Might as well get a class to do this for you:

C++ code:
class WinBOOL
{
public:
	WinBOOL(bool boolean) : m_internal(boolean ? TRUE : FALSE);
	WinBOOL& operator=(bool boolean)
	{
		m_internal = boolean ? TRUE : FALSE;
		return *this;
	}
	operator BOOL() const
	{
		return m_internal;
	}
private:
	BOOL m_internal;
};

You son of a gun- don't give programmers any ideas :argh:. Cause this is what happens if you do.

VikingofRock
Aug 24, 2008




Hammerite posted:

Can't decide whether I'm being a bit too pedantic, or far too pedantic.

code:
void CMyDialog::EnableButtons(bool enabled)
{
	BOOL enabled_asWindowsBOOL = enabled ? TRUE : FALSE;

	m_button1.EnableWindow(enabled_asWindowsBOOL);
	m_button2.EnableWindow(enabled_asWindowsBOOL);
	m_button3.EnableWindow(enabled_asWindowsBOOL);
}

There ought to be a :windows: for this sort of thing.

MrMoo
Sep 14, 2000

I've seen that a lot in APIs that like to define their own bool value because they are old. They continue to do it even when they have stopped support a long time ago for those clunky compilers.

Absurd Alhazred
Mar 27, 2010

by Athanatos

MrMoo posted:

I've seen that a lot in APIs that like to define their own bool value because they are old. They continue to do it even when they have stopped support a long time ago for those clunky compilers.

That doesn't explain Vulkan. :v:

idiotmeat
Apr 3, 2010

Absurd Alhazred posted:

Might as well get a class to do this for you:

C++ code:
class WinBOOL
{
public:
	WinBOOL(bool boolean) : m_internal(boolean ? TRUE : FALSE);
	WinBOOL& operator=(bool boolean)
	{
		m_internal = boolean ? TRUE : FALSE;
		return *this;
	}
	operator BOOL() const
	{
		return m_internal;
	}
private:
	BOOL m_internal;
};

Might want to have
code:

boolean ? !FALSE : FALSE
Just to be safe.

SupSuper
Apr 8, 2009

At the Heart of the city is an Alien horror, so vile and so powerful that not even death can claim it.

MrMoo posted:

I've seen that a lot in APIs that like to define their own bool value because they are old. They continue to do it even when they have stopped support a long time ago for those clunky compilers.
Most compilers still default to C89 rather than C99 which officially supports bool. :shrug:

VikingofRock
Aug 24, 2008




SupSuper posted:

Most compilers still default to C89 rather than C99 which officially supports bool. :shrug:

Wait, what? I mostly use gcc, clang, and icc, and I think all of those default to C11 nowadays, with slightly older versions defaulting to C99. What widely used C compilers still default to C89?

Gul Banana
Nov 28, 2003

msvc

Spatial
Nov 15, 2007

No it doesn't. It's C99.

Meat Beat Agent
Aug 5, 2007

felonious assault with a sproinging boner
GCC 4.9 isn't that old, is it?

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Spatial posted:

No it doesn't. It's C99.

I thought MSVC was only kind-of modern (if you can call C99 modern) because their focus was on the bits relevant to C++, so some parts of the C standard aren't up-to-date?

That's just hearsay though.

Coffee Mugshot
Jun 26, 2010

by Lowtax

MrMoo posted:

I've seen that a lot in APIs that like to define their own bool value because they are old. They continue to do it even when they have stopped support a long time ago for those clunky compilers.

I'm a little confused because defining your own Boolean type isn't particularly a weird thing. That code snippet appears to be doing the weirdest type conversion I have ever seen. Without knowing what BOOL actually is (probably an integral value ), why can't the above code just do a simple type conversion from bool to BOOL? Knowing this is some C dialect, why wouldn't that function just take BOOLs as parameters in the first place so that implicit conversion could take over. Hell, even taking in a Boolean as a void* is a better approach than that snippet.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Recent versions of msvc don't even support compiling in c89 mode.

TooMuchAbstraction posted:

I thought MSVC was only kind-of modern (if you can call C99 modern) because their focus was on the bits relevant to C++, so some parts of the C standard aren't up-to-date?

That's just hearsay though.

For years they said they weren't going to ever support any C features past C89 except where required by newer C++ standards, but then ffmpeg wrote a c99 to c89 converter and this was sufficiently embarrassing that the people inside MS who wanted c99 support were able to get everything that ffmpeg needs implemented (which is basically everything not made optional in c11).

Meat Beat Agent posted:

GCC 4.9 isn't that old, is it?

It's two major versions behind and GCC 7 isn't that far out.

JewKiller 3000
Nov 28, 2006

by Lowtax
go is the donald trump of programming languages: someday everyone is going to simultaneously realize that it's garbage, and the retards who went along with it will lose all respect

Odette
Mar 19, 2011

JewKiller 3000 posted:

go is the donald trump of programming languages: someday everyone is going to simultaneously realize that it's garbage, and the retards who went along with it will lose all respect

How do you feel about Rust, then?

Foxfire_
Nov 8, 2010

Coffee Mugshot posted:

I'm a little confused because defining your own Boolean type isn't particularly a weird thing. That code snippet appears to be doing the weirdest type conversion I have ever seen. Without knowing what BOOL actually is (probably an integral value ), why can't the above code just do a simple type conversion from bool to BOOL? Knowing this is some C dialect, why wouldn't that function just take BOOLs as parameters in the first place so that implicit conversion could take over. Hell, even taking in a Boolean as a void* is a better approach than that snippet.

windows.h posted:

typedef int BOOL;
#define TRUE 1
#define FALSE 0

windows.h is older than stdbool.h, so it defined its own boolean type. It's still around because using the standard one is not worth breaking the API and ABI of just about everything in windows (sizeof(BOOL) != sizeof(bool), in theory or in practice)

That's a perfectly fine snippet since it's obvious what its doing.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Absurd Alhazred posted:

Might as well get a class to do this for you:

The assignment operator here is unnecessary: a bool can be converted to a WinBOOL to invoke the standard assignment operator.

If you're worried about the multiple-conversion case, the better solution is a constructor template.

gonadic io
Feb 16, 2011

>>=

Odette posted:

How do you feel about Rust, then?
Rust would have won!

Coffee Mugshot
Jun 26, 2010

by Lowtax

JewKiller 3000 posted:

go is the donald trump of programming languages: someday everyone is going to simultaneously realize that it's garbage, and the retards who went along with it will lose all respect

But it collects the garbage faster than the humans can perceive...

Coffee Mugshot
Jun 26, 2010

by Lowtax

JewKiller 3000 posted:

go is the donald trump of programming languages: someday everyone is going to simultaneously realize that it's garbage, and the retards who went along with it will lose all respect

Is this guy calling Ken Thompson a retard? Asking for Rob Pike and Robert Griesemer.

KernelSlanders
May 27, 2013

Rogue operating systems on occasion spread lies and rumors about me.
code:
In [1]: '\|' == '\\|'
Out[1]: True

In [2]: '\n' == '\\n'
Out[2]: False
If I ever invent a language naked backslash is definitely going to be a compile error.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

KernelSlanders posted:

code:
In [1]: '\|' == '\\|'
Out[1]: True

In [2]: '\n' == '\\n'
Out[2]: False
If I ever invent a language naked backslash is definitely going to be a compile error.

:agreed:

and that goes double for regex libraries

idiotmeat
Apr 3, 2010
I don't know what is with the folks that I work with but they are really afraid of removing dead code. For example (not real code):

code:

if A:
  if A or B:
    foo(
      Bar1,
      /* leaving a comment to let you know i deleted an argument go look at the diffs to figure out which one */
      Bar2)

  If not B and not A:
    doSomethingLongAndComplexWithBadCodeSmell()

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

idiotmeat posted:

I don't know what is with the folks that I work with but they are really afraid of removing dead code. For example (not real code):

I had a job once to rehabilitate a university lab's codebase. It was riddled with that kind of thing. Best I can tell, that's what happens when you don't know about / trust source control, but still want to know what the history of a given chunk of code is.

I deleted easily 20k lines worth of dead code from that codebase. After checking it all in to source control, of course.

Adbot
ADBOT LOVES YOU

Doom Mathematic
Sep 2, 2008
Honestly, that's the easy stuff. It's relaxing, like pruning topiary.

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