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

Author Topic: SFML Blueprints - Another SFML book  (Read 50040 times)

0 Members and 1 Guest are viewing this topic.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: SFML Blueprints - Another SFML book
« Reply #30 on: September 13, 2015, 05:57:22 pm »
They are a legacy from a time where many systems couldn't type characters like "!", "{" and "|". These days they should just be avoided. C++17 even removes (not just deprecate) a lot of that old cruft.
It's like "the 80's called; they want their trigraphs back" ;)

You're wrong.
C++17  rewove Trigraph ( ??<, ??( ,...) that's true.
But here we are speaking of the alternative operators (and, or, not, xor, bit_or, ...) of standard ISO C++  created a while ago.
They have been there since C++98, not exactly a recent addition. And they've been in C even longer IIRC (<iso646.h>)
But they have always been alternative operators intended to be used when you either cannot input the primary ones or if the source file is using an encoding where the primary ones cause trouble. As far as I understand they have never been intended for use except when you have to.

I understand that it can be confusing at first but, we are talking about a book. And the goal of it is to learn some new thing to the reader. Maybe it can be the first one.
IMHO a good book shouldn't teach bad habits and teaching people to use operator names that almost noone actually use and which will confuse other programmers is a bad thing.

And for the record, I wouldn't consider this to be more readable:
%:include <iostream>
 
int main(int argc, char *argv<::>)
<%
    if (argc > 1 and argv<:1:> not_eq NULL) <%
        std::cout << "Hello, " << argv<:1:> << '\n';
    %>
%>
not even if you stick to just 'and' and 'not_eq' in the above (example from here).

But whatever. I don't want to argue this any further.
« Last Edit: September 13, 2015, 06:13:19 pm by Jesper Juhl »

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: SFML Blueprints - Another SFML book
« Reply #31 on: September 13, 2015, 06:16:22 pm »
By the way: Congratulations on actually finishing a book :)
I guess I should go buy and read it ;)

Krozark

  • Newbie
  • *
  • Posts: 36
    • View Profile
    • site perso
Re: SFML Blueprints - Another SFML book
« Reply #32 on: September 13, 2015, 06:24:24 pm »
I'm totally agree with you concerning the usage of digraphs and trigraphs.
Concerning the alternatives keywords, this is another story.
I've came to the point that this is maybe like the indentation (tabs / spaces) or comparison order (var == value / value == var)  : just different point of view.

By the way: Congratulations on actually finishing a book :)

Thanks !

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML Blueprints - Another SFML book
« Reply #33 on: September 13, 2015, 07:52:20 pm »
Concerning the alternatives keywords, this is another story.
I've came to the point that this is maybe like the indentation (tabs / spaces) or comparison order (var == value / value == var)  : just different point of view.

That's exactly what it is to me. Some teach `and` and some teach `&&` to their pupils/readers. Sometimes you use one style for a specific context, and another style for another context. It's especially important when you start writing code for the first time: you need something that is easily understandable to you and in this case `and` is much more readable that `&&` IMO. So I wouldn't call *that* bad practice.
SFML / OS X developer

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: SFML Blueprints - Another SFML book
« Reply #34 on: September 13, 2015, 08:05:53 pm »
I'm calling it "bad practice" since it's different from what 99% of other C++ programmers use. Thus it's prone to cause confusion. It's also not supported by default by Visual Studio (which is again a barrier) and no, "/Za" does not really fix that since it has other implications as well.
It's simply a bad, non(defacto)-standard, confusing, choice to teach.
« Last Edit: September 13, 2015, 08:11:21 pm by Jesper Juhl »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: SFML Blueprints - Another SFML book
« Reply #35 on: September 13, 2015, 08:23:34 pm »
Because one IDE doesn't respect the standard we should not use a standard feature? (I've heard that including <ciso646> would make VS happy but never could try...) To me it's not a strong argument.
SFML / OS X developer

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: SFML Blueprints - Another SFML book
« Reply #36 on: September 13, 2015, 08:27:58 pm »
I personally consider the "not known/used by most (any that don't have to?) C++ programmers" the strongest argument.
It's obscure, rarely used and bound to cause confusion.
VS non-default support just adds to the argument.

Krozark

  • Newbie
  • *
  • Posts: 36
    • View Profile
    • site perso
Re: SFML Blueprints - Another SFML book
« Reply #37 on: September 14, 2015, 10:04:30 am »
I propose to stop the conversation about alternative tokens,as we totally derived from the topic of this thread.
It seems obvious that everyone has a different point of view, and this will not change.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML Blueprints - Another SFML book
« Reply #38 on: September 14, 2015, 11:27:09 pm »
Yes, let's move on, the discussion is really running in circles ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

PewPew

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: SFML Blueprints - Another SFML book
« Reply #39 on: September 15, 2015, 05:59:10 pm »
Hi,

Uhm did you add some shaders in the book?

Krozark

  • Newbie
  • *
  • Posts: 36
    • View Profile
    • site perso
Re: SFML Blueprints - Another SFML book
« Reply #40 on: September 15, 2015, 06:08:29 pm »
No as it was already detail in another SFML book (the first one).

LanceJZ

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: SFML Blueprints - Another SFML book
« Reply #41 on: October 25, 2015, 01:54:31 am »
Hi, I'm on chapter 7 and I'm having an issue building the library for SFML-utils-es I get an error code C2065 'ENTITY': undeclared identifier in line 104. I'm using VS 2015. That error seems to cause 78 other errors in EntityManager.hpp/EntityManager.tpl related to that. There are no other errors in other headers.
I got the SFML-utils-core library to compile just fine. I have not tried the others yet. I changed all the 'and' to &&, 'or' to || and 'not' to ! to do so. As it should have been in the first place.
If you could help, I could maybe learn something. I've been working on this for two days with no luck.

I'm also unable to compile the cpp-utils library. On sys.cpp on line 8 I get PATH_MAX : undeclared identifier and other errors all in sys.cpp.
I also fixed a typo, you had __WIN32 instead of _WIN32 in one of your #ifdef Ln 423.
I would like to be able to compile all of these.
Thank you.

Krozark

  • Newbie
  • *
  • Posts: 36
    • View Profile
    • site perso
Re: SFML Blueprints - Another SFML book
« Reply #42 on: October 26, 2015, 09:32:37 am »


Edit :  PATH_MAX is define by windows headers.




« Last Edit: October 26, 2015, 09:37:51 am by Krozark »

LanceJZ

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: SFML Blueprints - Another SFML book
« Reply #43 on: October 27, 2015, 11:02:45 pm »
Those files are not included with the book, you have us download from your github site... Don't you even remember your own book? x.x
I want to use Visual Studio 2015, that is the one I plan on using in my games. I am not learning to do it your way, I want to learn how to do it my way...

SpeCter

  • Full Member
  • ***
  • Posts: 151
    • View Profile
Re: SFML Blueprints - Another SFML book
« Reply #44 on: October 28, 2015, 09:36:57 am »
Those files are not included with the book, you have us download from your github site... Don't you even remember your own book? x.x
I want to use Visual Studio 2015, that is the one I plan on using in my games. I am not learning to do it your way, I want to learn how to do it my way...

You can download the code files from packt, so basically they "ship" with the book, but since they more often than not ship with the initial version of the code and not the ones which contains fixes made after the book release it is adviced to download them from github...