Author Topic: private static bool GetTrue() { return true; }  (Read 13083 times)

Spectere

  • \m/ (-_-) \m/
  • Administrator
  • Hero Member
  • *****
  • Posts: 5716
  • printf("%s\n", "Hi!");
    • View Profile
    • spectere.net
"This is a machine for making cows."

Bobbias

  • #1 Poster
  • Hero Member
  • *****
  • Posts: 7210
  • 404 Avatar not found.
    • View Profile
    • Magnetic Architect
Re: private static bool GetTrue() { return true; }
« Reply #1 on: June 09, 2008, 08:02:20 AM »
Haha, that was awesome.
This is going in my sig. :)

BANNED FOR BAD PUNS X_x

Sneaky

  • Windows 8 Knowledge Base
  • Hero Member
  • *****
  • Posts: 1297
  • Where I come from they call it the Hibbity Dibbity
    • View Profile
Re: private static bool GetTrue() { return true; }
« Reply #2 on: June 09, 2008, 04:36:19 PM »
Gotta love how anyone who knows any bit of coding thinks they're the kind shit of nerds/programmers. I fucking hate that shit.

LETS START AN E PEEN CONTEST TO SEE WHO CAN COME UP WITH THE MOST VARIATIONS OF THIS CODE ALOALOOLOLOL JUAJUAJUAJUAJ JEJEJEJEJE

:l
I wish that cake was a lie. :(

I guess he never figured out what Willis was saying :/

Spectere

  • \m/ (-_-) \m/
  • Administrator
  • Hero Member
  • *****
  • Posts: 5716
  • printf("%s\n", "Hi!");
    • View Profile
    • spectere.net
Re: private static bool GetTrue() { return true; }
« Reply #3 on: June 09, 2008, 06:05:14 PM »
LETS START AN E PEEN CONTEST TO SEE WHO CAN COME UP WITH THE MOST VARIATIONS OF THIS CODE ALOALOOLOLOL JUAJUAJUAJUAJ JEJEJEJEJE

private static bool GetTrue() { return true; }
private static bool GetTrue() { return !false; }
private static bool GetTrue() { if(1==1) return true; else return false; }
private static bool GetTrue() { if(0==1) return false; else return true; }

...etc...
"This is a machine for making cows."

Bobbias

  • #1 Poster
  • Hero Member
  • *****
  • Posts: 7210
  • 404 Avatar not found.
    • View Profile
    • Magnetic Architect
Re: private static bool GetTrue() { return true; }
« Reply #4 on: June 09, 2008, 07:11:42 PM »
private static bool GetTrue() { '0' < '1' ? return 1 : return 0; }
This is going in my sig. :)

BANNED FOR BAD PUNS X_x

Spectere

  • \m/ (-_-) \m/
  • Administrator
  • Hero Member
  • *****
  • Posts: 5716
  • printf("%s\n", "Hi!");
    • View Profile
    • spectere.net
Re: private static bool GetTrue() { return true; }
« Reply #5 on: June 09, 2008, 10:53:48 PM »
Ah, testing for truth with random, magic chars!  Nice touch.  I would have probably done something silly like this: 'A' < 'a' ? return true : return false; but hey, whatever works.

One little nitpick -- that code won't compile.  For the language bool type you have to use "true" and "false".  If it were a BOOL (like what Win32 uses, being a C-friendly API; note the caps) then everything would be kosher.
« Last Edit: June 09, 2008, 10:57:52 PM by Spectere »
"This is a machine for making cows."

Zakamiro

  • Hero Member
  • *****
  • Posts: 1053
  • Foxy mama.
    • View Profile
    • Someplace
Re: private static bool GetTrue() { return true; }
« Reply #6 on: June 10, 2008, 06:40:36 AM »
Gotta love how anyone who knows any bit of coding thinks they're the kind shit of nerds/programmers. I fucking hate that shit.

LETS START AN E PEEN CONTEST TO SEE WHO CAN COME UP WITH THE MOST VARIATIONS OF THIS CODE ALOALOOLOLOL JUAJUAJUAJUAJ JEJEJEJEJE

:l

reminds me of the thread spec and I shat up in emilio's comedy barn.


We pressed on. Shortly afterwards, we arrived in a poisonous, post-apocalyptic hell - a sprawling, toxic dumping ground stretching for a mile or two. This is the final resting place for your old TV, computer or mobile phone.

Spectere

  • \m/ (-_-) \m/
  • Administrator
  • Hero Member
  • *****
  • Posts: 5716
  • printf("%s\n", "Hi!");
    • View Profile
    • spectere.net
Re: private static bool GetTrue() { return true; }
« Reply #7 on: June 10, 2008, 06:49:06 AM »
reminds me of the thread spec and I shat up in emilio's comedy barn.

We are very good at shitting, yes.
"This is a machine for making cows."

Bobbias

  • #1 Poster
  • Hero Member
  • *****
  • Posts: 7210
  • 404 Avatar not found.
    • View Profile
    • Magnetic Architect
Re: private static bool GetTrue() { return true; }
« Reply #8 on: June 10, 2008, 08:13:17 AM »
Ah, testing for truth with random, magic chars!  Nice touch.  I would have probably done something silly like this: 'A' < 'a' ? return true : return false; but hey, whatever works.

One little nitpick -- that code won't compile.  For the language bool type you have to use "true" and "false".  If it were a BOOL (like what Win32 uses, being a C-friendly API; note the caps) then everything would be kosher.

I was sorta assuming it was gonna be written in plain C/C++. Back in the old books I read, I thought I remembered something about C/C++ not caring what you passed into a bool because when it saw bool, it would just check for zero/non zero, regardless of what it actually was.

I haven't worked in C/C++ in fucking forever though.
This is going in my sig. :)

BANNED FOR BAD PUNS X_x

Spectere

  • \m/ (-_-) \m/
  • Administrator
  • Hero Member
  • *****
  • Posts: 5716
  • printf("%s\n", "Hi!");
    • View Profile
    • spectere.net
Re: private static bool GetTrue() { return true; }
« Reply #9 on: June 10, 2008, 02:48:55 PM »
C doesn't have the bool type and C++ does, in fact, seem to allow you to use bool as an unsigned integer (tested with Visual C++ 2008 Express).  I think I've been using C# too much. :P

I seem to recall getting a compiler error from something when I tried to compare a bool to an int.  I might have had the compiler set to a really pedantic setting, though.
"This is a machine for making cows."

Zakamiro

  • Hero Member
  • *****
  • Posts: 1053
  • Foxy mama.
    • View Profile
    • Someplace
Re: private static bool GetTrue() { return true; }
« Reply #10 on: June 10, 2008, 05:19:04 PM »
I don't want to derail the thread, but someone talked shit about me trying to learn visual c++ 2005. They said it was to "old" and I should switch to a "better" and "newer" language because apparent c/c++ were outdated. Well, C needs way less code than nearly every language out there (except for obviously ASM, machine), and is a much better performer than C#.

Quote from: http://en.wikipedia.org/wiki/C_Sharp_(programming_language)#Performance
Performance

C# programs, like all programs written for the .NET and other virtual machine environments such as Java, tend to require more system resources than functionally similar applications that access machine resources more directly.

Anyway, object-oriented design is still a little new for me, most of my experience comes from mIRC code, where the most object oriented design you get comes from hash tables and ini files. Ehm. Yeah. Thoughts/opinions?


We pressed on. Shortly afterwards, we arrived in a poisonous, post-apocalyptic hell - a sprawling, toxic dumping ground stretching for a mile or two. This is the final resting place for your old TV, computer or mobile phone.

Spectere

  • \m/ (-_-) \m/
  • Administrator
  • Hero Member
  • *****
  • Posts: 5716
  • printf("%s\n", "Hi!");
    • View Profile
    • spectere.net
Re: private static bool GetTrue() { return true; }
« Reply #11 on: June 10, 2008, 06:14:04 PM »
Naturally.

The real deal with languages like that is that you have to find the right balance of speed and convenience for what you want to do.  C# is a hell of a lot easier than C++ which is a hell of a lot easier than C.
"This is a machine for making cows."

Bobbias

  • #1 Poster
  • Hero Member
  • *****
  • Posts: 7210
  • 404 Avatar not found.
    • View Profile
    • Magnetic Architect
Re: private static bool GetTrue() { return true; }
« Reply #12 on: June 11, 2008, 08:08:26 AM »
Naturally.

The real deal with languages like that is that you have to find the right balance of speed and convenience for what you want to do.  C# is a hell of a lot easier than C++ which is a hell of a lot easier than C.

Agreed.
I learned C++, I've never really known what the differences were between C and C++, to be honest. I do know that c people use printf where lazy C++ users use cout. And Strings are new to C++, but that's all I really know, lol.
This is going in my sig. :)

BANNED FOR BAD PUNS X_x

Spectere

  • \m/ (-_-) \m/
  • Administrator
  • Hero Member
  • *****
  • Posts: 5716
  • printf("%s\n", "Hi!");
    • View Profile
    • spectere.net
Re: private static bool GetTrue() { return true; }
« Reply #13 on: June 11, 2008, 06:58:48 PM »
Lessee, C++ introduces classes (which include the ability to overload operators), uses streams for most IO functions (cout, fout, etc), adds the bool type, templates, and I think that's about it (though those changes alone are quite significant).

The string type isn't technically a built-in type.  It's part of the standard C++ library.  The new features that C++ offers (namely, classes and operator overloading) are what allows them to appear to be integrated into the language.
"This is a machine for making cows."

Bobbias

  • #1 Poster
  • Hero Member
  • *****
  • Posts: 7210
  • 404 Avatar not found.
    • View Profile
    • Magnetic Architect
Re: private static bool GetTrue() { return true; }
« Reply #14 on: June 11, 2008, 10:27:59 PM »
Ok, yeah, i knew most of those, i just didn't think of it.
This is going in my sig. :)

BANNED FOR BAD PUNS X_x