OFFICIAL GML Consistency in GMS2 v2.2.2

Discussion in 'Announcements' started by rmanthorp, Feb 20, 2019.

  1. Elodman

    Elodman Member

    Joined:
    Mar 10, 2017
    Posts:
    13
    Mike quit YYG !!!?!??
    An interesting read he has presented on his blog indeed.

    * * *
    May you find peace and your endeavors be ever fruitful !
    I, we owe you much.
    * * *

     
  2. Josepho

    Josepho Member

    Joined:
    Nov 26, 2016
    Posts:
    38
    It should be a warning instead of an error, now i have a 10 K code line project with lots of potential crashes. If you cast as real a string without numbers should be 0! thats how lots of languages work! For example casting a "" as real now gives a crash (imagine a csv file processed where blank numbers are assumed to be treaten as 0), very very bad decision yoyo¡¡¡
     
  3. Storyteller

    Storyteller Member

    Joined:
    Jul 19, 2016
    Posts:
    251
    go C style and just make all chars ints.
     
  4. Lonewolff

    Lonewolff Member

    Joined:
    Jan 8, 2018
    Posts:
    1,142
    o_O
     
  5. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,360
    Is there any language where this is not the case?
    Even in GML!
    You convert between a character (a real number) and a string containing just that character using the chr() function.
     
  6. Lonewolff

    Lonewolff Member

    Joined:
    Jan 8, 2018
    Posts:
    1,142
    FWIW, chars are not ints.

    Try this in C

    Code:
    if(sizeof(char) == sizeof(int))
        std::cout << "I stand corrected";
    
     
  7. kraifpatrik

    kraifpatrik Member

    Joined:
    Jun 23, 2016
    Posts:
    116
    EDIT: ^ won't compile, that's C++

    I don't think @Storyteller meant chars and ints specifically, but just as an example. C is also not all just chars and ints.
     
  8. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,360
    Well on my machine that works.
    Because an int is define to be at least the size of a short. And a short is defined to be at least the size of a char.
     
  9. Storyteller

    Storyteller Member

    Joined:
    Jul 19, 2016
    Posts:
    251
    in C, as in ANSI C, a 'char' is an 'int'. C != C++
    there are some differences in implementation, but in general, 'chars' are represented as integers. not even just 'binary numbers', actual integers.
    most operations and functions on chars work with or return ints. Ive been reading up on this lately.

    you may have different types, different sizes, but the specification declares chars as 'a minimum size of integers', depending on your platform or compiler.
    By 'spec', all chars in C, are ints.
    most often they map to standard ASCII. your mileage may vary, but for the most part this is true.

    'A' + 1 = 'B';

    consider this man page on 'getchar'; it returns an int.
    https://linux.die.net/man/3/getchar

    edit: grammar, added link
     
    Last edited: May 10, 2019

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice