Giter Club home page Giter Club logo

Comments (4)

asmaloney avatar asmaloney commented on June 5, 2024

Thanks @EpicWink.

There's something that doesn't make sense to me: How is it your compiler thinks that uint64_t is an unsigned long and not an unsigned long long?

(I don't have Linux installed, so I can't poke around.)

from meshio.

EpicWink avatar EpicWink commented on June 5, 2024

Difference in data-model I guess: Unix 64-bit says long is 64 bits, but Windows 64-bit and Unix/Windows 32-bit says long is 32 bits; see Fundamental types and Fixed width integer types.

For me the following

#include<cstdint>

int main(int argc, char** argv) {
    uint64_t *a;
    unsigned long long b[3];
    a = b + 2;
}

Gives me:

int.cpp: In function ‘int main(int, char**)’:
int.cpp:6:11: error: invalid conversion from ‘long long unsigned int*’ to ‘uint64_t*’ {aka ‘long unsigned int*’} [-fpermissive]
    6 |     a = b + 2;
      |         ~~^~~
      |           |
      |           long long unsigned int*

Whereas unsigned long works fine. Likewise:

  • uint32_t needs unsigned int
  • uint16_t needs unsigned short
  • uint8_t needs unsigned char

from meshio.

asmaloney avatar asmaloney commented on June 5, 2024

...and here I was thinking the whole purpose of the cstdint types was cross-platform compatibility. :-(

I don't tend to use them in my own stuff unless I have to interface with things that do... but I'm pretty old school :-)

from meshio.

EpicWink avatar EpicWink commented on June 5, 2024

cstdint types are the same on every platform. It's the fundamental C types which are different for some reason

from meshio.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.