Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 451 452 [453] 454 455 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 887340 times)

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6780 on: December 06, 2014, 07:48:18 am »

I'd say that I'm at least decent in programming in general. I've been a maintainer for some open source game for half a year or so :V
So yeah a tutorial to learn c++ would be convenient. doesn't have to be newbie-level stuff.
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

Gentlefish

  • Bay Watcher
  • [PREFSTRING: balloon-like qualities]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6781 on: December 06, 2014, 07:59:06 am »

c plus plus is a great reference site. It has reference to all of the C/C++ libraries and what they contain, what they do, and how they break. It also comes with tutorials (of which I have not looked at)! Seriously, when it comes to "I need to do x but I don't know what built-ins I need", this site has X, Y, and Z to do it listed by library then class.

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6782 on: December 09, 2014, 10:39:12 am »

This seems like something relevant to post in the Bay12 coders thread: https://isocpp.org/blog/2014/12/myths-1

Quote from: Bjarne Stroustrup
In this three-part series, I will explore, and debunk, five popular myths about C++:

“To understand C++, you must first learn C”
“C++ is an Object-Oriented Language”
“For reliable software, you need Garbage Collection”
“For efficiency, you must write low-level code”
“C++ is for large, complicated, programs only”
« Last Edit: December 09, 2014, 10:47:59 am by Thief^ »
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

Uristides

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6783 on: December 09, 2014, 11:42:53 am »

c plus plus is a great reference site. It has reference to all of the C/C++ libraries and what they contain, what they do, and how they break. It also comes with tutorials (of which I have not looked at)! Seriously, when it comes to "I need to do x but I don't know what built-ins I need", this site has X, Y, and Z to do it listed by library then class.
I actually learnt from that tutorial. Like, my first contact with programming ever. That I got so far as to have a limited understanding of pointers  can probably count as praise for it  :P
Logged

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #6784 on: December 09, 2014, 03:54:13 pm »

Quote from: Bjarne Stroustrup
myths

“C++ is an Object-Oriented Language”
Hm.
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6785 on: December 09, 2014, 04:07:17 pm »

Quote from: Bjarne Stroustrup
myths

“C++ is an Object-Oriented Language”
Hm.

Bad word choice for the bullet point. Judging by his explanation, the myth should probably read "C++ is just an object-oriented language" (meaning no functional, procedural, etc - just OO).
Logged

Gentlefish

  • Bay Watcher
  • [PREFSTRING: balloon-like qualities]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6786 on: December 09, 2014, 07:56:23 pm »

I actually use C++ as a functional programming language - sure, absolutely, OO is the way to go sometimes. But functional programming is getting me everywhere I need to right now, in C++.

optimumtact

  • Bay Watcher
  • I even have sheep
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6787 on: December 16, 2014, 04:24:15 pm »

The only thing that bugs me about C++ is that there is so much stuff in the standard that everyone seems to speak a different sub dialect of things they have picked up.
Logged
alternately, I could just take some LSD or something...

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6788 on: December 21, 2014, 08:44:56 am »

Hmph...

Code: [Select]
class Class {
    char One;
    char Two;
    int Three;
    short Four;
};
Takes 12 bytes of memory, and
Code: [Select]
class Class {
    int Three;
    short Four;
    char One;
    char Two;
};
takes only 8.

That's 50% more, and if you plan on making thousands of the damn things like me, then that's just terrible. (C++)
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

i2amroy

  • Bay Watcher
  • Cats, ruling the world one dwarf at a time
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6789 on: December 21, 2014, 03:41:59 pm »

Yeah, but you'd have to make over 250,000 of those things before the difference even added up to a single MB. I mean sure, I could see the difference if for some reason you needed to make millions of the things, but most computers these days are swimming in so much memory that a 4 byte difference per class instance isn't going to make any real noticeable impact (not absolute best practice of course, but in most cases it's going to fall well below the work/reward threshold IMO).
Logged
Quote from: PTTG
It would be brutally difficult and probably won't work. In other words, it's absolutely dwarven!
Cataclysm: Dark Days Ahead - A fun zombie survival rougelike that I'm dev-ing for.

EnigmaticHat

  • Bay Watcher
  • I vibrate, I die, I vibrate again
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6790 on: December 21, 2014, 03:43:17 pm »

Anyone want to explain to me why that would happen?
Logged
"T-take this non-euclidean geometry, h-humanity-baka. I m-made it, but not because I l-li-l-like you or anything! I just felt s-sorry for you, b-baka."
You misspelled seance.  Are possessing Draignean?  Are you actually a ghost in the shell? You have to tell us if you are, that's the rule

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #6791 on: December 21, 2014, 03:54:07 pm »

I'm going to take a stab in the dark and say it's something to do with the bits.
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

Uristides

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6792 on: December 21, 2014, 04:27:38 pm »

My first thought was about how stuff has to be lined up in memory in the x86 architecture. It's been a long time, but IIRC they have to align in multiples of 4 bytes. I really thought compilers should be able to optimize that stuff away, so I don't know if that's it.
Logged

monkey

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6793 on: December 21, 2014, 05:08:28 pm »

You are right.
http://msdn.microsoft.com/en-us/library/2e70t5y1.aspx (gcc & clang have the option too)
Logged

Uristides

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6794 on: December 21, 2014, 05:15:03 pm »

Ok, hit AoA again and I'm pretty sure the answer, in all its gory details, is here here and here.
I was also obviously wrong in that things have to be aligned in multiples of 4 bytes or else you explode the internet. It's just the way to align things if you're too lazy to play memory tetris and don't mind squandering some bytes in exchange for a quite dubious gain when fetching stuff.
Logged
Pages: 1 ... 451 452 [453] 454 455 ... 796