macchina-io / macchina.io

macchina.io EDGE is a powerful C++ and JavaScript SDK for edge devices, multi-service IoT gateways and connected embedded systems.
https://macchina.io
GNU General Public License v3.0
515 stars 154 forks source link

Missing definitions for MACOS #95

Open URecke opened 5 years ago

URecke commented 5 years ago

https://github.com/macchina-io/macchina.io/blob/0e2b625c61a75e1400c2984a15843dc8cca93b3b/platform/Foundation/include/Poco/Types.h#L64

64 bit is now the default on Mac. However Apple uses long long instead of long. To be compatible the following is suggested:

#elif defined(__APPLE__)
    #define POCO_PTR_IS_64_BIT 1
    typedef signed long long   IntPtr;
    typedef unsigned long long UIntPtr;
    typedef signed long long   Int64;
    typedef unsigned long long UInt64;

(used and tried to pass is_same and similar with std types like std::uint64_t on Mac)

obiltschnig commented 5 years ago

OK, I understand the real issue now ;-) This would have to be fixed in the POCO C++ Libraries first. However, I remember having done that once before and it lead to some issues with other parts of Poco. IMO the best way would be to map Poco::Int64 to std::int64_t (etc.) on every platform. With the next version of Poco we're moving to C++11/14, so <cstdint> should be universally available.

URecke commented 5 years ago

Yes, that would be a good solution. Just to clarify even more: We observed side effects especially in templated code. e.g. Poco::Any results in different typed objects instantiated with std::int64_t and with Poco::Int64.

BTW to have the std types we use something similar like the following (missing clean namespace handling...)

`#pragma once

if __cplusplus >= 199711L

#include <cstdint>

elif ( defined(_MSC_VER) && _MSC_VER < 1600 )

// e.g. EC7 and others can use boost

include <boost\cstdint.hpp>

// Coding guidelines prevents the use of "using"
// keyword in headers. However this is needed
// to solve for compiler and platform differences
using boost::int8_t;
using boost::int16_t;
using boost::int32_t;
using boost::int64_t;
using boost::uint8_t;
using boost::uint16_t;
using boost::uint32_t;
using boost::uint64_t;

else

#include <stdint.h>

endif`

This could help to have a solution even before c++ 11

URecke commented 4 years ago

Should we move this issue to Poco project? Any news?

obiltschnig commented 4 years ago

Yes, this should be moved to Poco project. With the next release we're going to require C++11/C++14, so should be universally available.