Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I've noticed that your code is Visual Studio specific at the moment, so I'll give you a few tips you can use to make it more standard and portable.

  1. #pragma once is not standard, but it is supported by several compilers, so this is not an issue. Just for the record, an option to it would be an include guard.

  2. __int32 and __int8 are Microsoft specific. C++11 provides the header <cstdint>, which defines several sized integral types, including uint32_t and uint8_t. You should use those instead.

  3. __alignof is a pre-C++11 Visual Studio extension. The new C++ standard now provides the alignof operator, which should be used instead.

  4. _aligned_malloc() is also a Windows specific function, its Unix equivalent being memalign() or posix_memalign(). Your best course of action here would be to avoid calling _aligned_malloc() directly by creating a thin wrapper function that you can redirect to memalign/_aligned_malloc easily with some #ifdefs, in case you ever decide to port this code. See this SO questionthis SO question for more.

I've noticed that your code is Visual Studio specific at the moment, so I'll give you a few tips you can use to make it more standard and portable.

  1. #pragma once is not standard, but it is supported by several compilers, so this is not an issue. Just for the record, an option to it would be an include guard.

  2. __int32 and __int8 are Microsoft specific. C++11 provides the header <cstdint>, which defines several sized integral types, including uint32_t and uint8_t. You should use those instead.

  3. __alignof is a pre-C++11 Visual Studio extension. The new C++ standard now provides the alignof operator, which should be used instead.

  4. _aligned_malloc() is also a Windows specific function, its Unix equivalent being memalign() or posix_memalign(). Your best course of action here would be to avoid calling _aligned_malloc() directly by creating a thin wrapper function that you can redirect to memalign/_aligned_malloc easily with some #ifdefs, in case you ever decide to port this code. See this SO question for more.

I've noticed that your code is Visual Studio specific at the moment, so I'll give you a few tips you can use to make it more standard and portable.

  1. #pragma once is not standard, but it is supported by several compilers, so this is not an issue. Just for the record, an option to it would be an include guard.

  2. __int32 and __int8 are Microsoft specific. C++11 provides the header <cstdint>, which defines several sized integral types, including uint32_t and uint8_t. You should use those instead.

  3. __alignof is a pre-C++11 Visual Studio extension. The new C++ standard now provides the alignof operator, which should be used instead.

  4. _aligned_malloc() is also a Windows specific function, its Unix equivalent being memalign() or posix_memalign(). Your best course of action here would be to avoid calling _aligned_malloc() directly by creating a thin wrapper function that you can redirect to memalign/_aligned_malloc easily with some #ifdefs, in case you ever decide to port this code. See this SO question for more.

Changed one item in the suggestion list.
Source Link
glampert
  • 17.3k
  • 4
  • 31
  • 89

I've noticed that your code is Visual Studio specific at the moment, so I'll give you a few tips you can use to make it more standard and portable.

  1. #pragma once is not standard. Even though, but it is supported by several compilersseveral compilers, Iso this is not an issue. Just for the record, an option to it would suggest that you usebe an include guard instead.

  2. __int32 and __int8 are Microsoft specific. C++11 provides the header <cstdint>, which defines several sized integral types, including uint32_t and uint8_t. You should use those instead.

  3. __alignof is a pre-C++11 Visual Studio extension. The new C++ standard now provides the alignof operator, which should be used instead.

  4. _aligned_malloc() is also a Windows specific function, its Unix equivalent being memalign() or posix_memalign(). Your best course of action here would be to avoid calling _aligned_malloc() directly by creating a thin wrapper function that you can redirect to memalign/_aligned_malloc easily with some #ifdefs, in case you ever decide to port this code. See this SO question for more.

I've noticed that your code is Visual Studio specific at the moment, so I'll give you a few tips you can use to make it more standard and portable.

  1. #pragma once is not standard. Even though it is supported by several compilers, I would suggest that you use an include guard instead.

  2. __int32 and __int8 are Microsoft specific. C++11 provides the header <cstdint>, which defines several sized integral types, including uint32_t and uint8_t. You should use those instead.

  3. __alignof is a pre-C++11 Visual Studio extension. The new C++ standard now provides the alignof operator, which should be used instead.

  4. _aligned_malloc() is also a Windows specific function, its Unix equivalent being memalign() or posix_memalign(). Your best course of action here would be to avoid calling _aligned_malloc() directly by creating a thin wrapper function that you can redirect to memalign/_aligned_malloc easily with some #ifdefs, in case you ever decide to port this code. See this SO question for more.

I've noticed that your code is Visual Studio specific at the moment, so I'll give you a few tips you can use to make it more standard and portable.

  1. #pragma once is not standard, but it is supported by several compilers, so this is not an issue. Just for the record, an option to it would be an include guard.

  2. __int32 and __int8 are Microsoft specific. C++11 provides the header <cstdint>, which defines several sized integral types, including uint32_t and uint8_t. You should use those instead.

  3. __alignof is a pre-C++11 Visual Studio extension. The new C++ standard now provides the alignof operator, which should be used instead.

  4. _aligned_malloc() is also a Windows specific function, its Unix equivalent being memalign() or posix_memalign(). Your best course of action here would be to avoid calling _aligned_malloc() directly by creating a thin wrapper function that you can redirect to memalign/_aligned_malloc easily with some #ifdefs, in case you ever decide to port this code. See this SO question for more.

Reworded some sentences.
Source Link
glampert
  • 17.3k
  • 4
  • 31
  • 89

I've noticed that your code is Visual Studio specific at the moment, so I'll give you a few tips you can use to make it more standard and portable.

  1. Don't use #pragma once; that's Microsoft specific is not standard. InsteadEven though it is supported by several compilers, I would suggest that you use an include guard instead.

  2. __int32 and __int8 are also Microsoft specific. C++11 provides the header <cstdint>, which defines several sized integral types, including uint32_t and uint8_t. You should use those instead.

  3. __alignof is a pre-C++11 Visual Studio extension. The new C++ standard now provides the alignof operator, which should be used instead.

  4. _aligned_malloc() is also a Windows specific function, its Unix equivalent being memalign() or posix_memalign(). Your best course of action here would be to avoid calling _aligned_malloc() directly by creating a thin wrapper function that you can redirect to memalign/_aligned_malloc easily with some #ifdefs, in case you ever decide to port this code. See this SO question for more.

I've noticed that your code is Visual Studio specific at the moment, so I'll give you a few tips you can use to make it more standard.

  1. Don't use #pragma once; that's Microsoft specific. Instead, use an include guard.

  2. __int32 and __int8 are also Microsoft specific. C++11 provides the header <cstdint>, which defines several sized integral types, including uint32_t and uint8_t. You should use those instead.

  3. __alignof is a pre-C++11 Visual Studio extension. The new C++ standard now provides the alignof operator, which should be used instead.

  4. _aligned_malloc() is also a Windows specific function, its Unix equivalent being memalign() or posix_memalign(). Your best course of action here would be to avoid calling _aligned_malloc() directly by creating a thin wrapper function that you can redirect to memalign/_aligned_malloc easily with some #ifdefs in case you ever decide to port this code. See this SO question for more.

I've noticed that your code is Visual Studio specific at the moment, so I'll give you a few tips you can use to make it more standard and portable.

  1. #pragma once is not standard. Even though it is supported by several compilers, I would suggest that you use an include guard instead.

  2. __int32 and __int8 are Microsoft specific. C++11 provides the header <cstdint>, which defines several sized integral types, including uint32_t and uint8_t. You should use those instead.

  3. __alignof is a pre-C++11 Visual Studio extension. The new C++ standard now provides the alignof operator, which should be used instead.

  4. _aligned_malloc() is also a Windows specific function, its Unix equivalent being memalign() or posix_memalign(). Your best course of action here would be to avoid calling _aligned_malloc() directly by creating a thin wrapper function that you can redirect to memalign/_aligned_malloc easily with some #ifdefs, in case you ever decide to port this code. See this SO question for more.

deleted 12 characters in body
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238
Loading
Source Link
glampert
  • 17.3k
  • 4
  • 31
  • 89
Loading