Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Check out my Engine!  (Read 10952 times)

0 Members and 1 Guest are viewing this topic.

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Re: Check out my Engine!
« Reply #15 on: July 26, 2013, 03:33:04 pm »
netrick, I believe that on declaration assignments are equivalent to initializer lists, more than to actual assignments.

Plus, even while doing that is fine, you don't always want to expose the initial values of members in the declaration :D

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Check out my Engine!
« Reply #16 on: July 26, 2013, 04:19:50 pm »
netrick, I believe that on declaration assignments are equivalent to initializer lists, more than to actual assignments.
That.

Also keep in mind that the initializer list suggestion was based on the initial code, which didn't use init lists nor declare assignments. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Check out my Engine!
« Reply #17 on: July 26, 2013, 07:33:15 pm »
Of course there are cases when you must use initializers list, but generally I think that assignments are better.
These are not assignments.

Even if there is the "=" sign, what is actually performed are initializations. This is an important difference, assignments overwrite the object after its construction (instead of directly constructing it) -- which is unnecessary, and sometimes even impossible.

Faster and easier solution than initializers lists.
Why would that be faster?

And it's only easier as long as you have very trivial cases. Usually, at least some members depend on constructor parameters, so you have to mix both and look at two places to see how variables initialized. Furthermore, the initialization inside the class definition may introduce unneeded header dependencies in more complex examples. It also exposes implementation details to the header, requiring clients to recompile whenever the values are changed.

Even if C++11 has introduced many useful things, this is one of the debatable features (besides the "uniform" initialization, for example). It certainly has its use cases, but it's far from replacing existing features.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

cloudncali

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • http://jakesmakes.tumblr.com/
Re: Check out my Engine!
« Reply #18 on: July 28, 2013, 08:20:40 am »
Great stuff your working on :)

I am a contributor to the GQE project. http://code.google.com/p/gqe/ its a game engine using SFML. Feel free to use and/or learn from our engine for your own project. GatorQue (the owner) has done some really nice stuff on it.

I've been using it for my games. I Wrote the entity module and the Property Manager.

 

anything