Skip to content

Commit ddb0796

Browse files
committed
header
1 parent 3ce3ee6 commit ddb0796

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/rebound.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,29 @@
2727
#define _MAIN_H
2828

2929
#define REB_API // Public REBOUND API definitions
30+
31+
// The restrict keyword has different spellings in different compilers
32+
#if defined(_MSC_VER)
33+
#define REB_RESTRICT __restrict
34+
#pragma comment(lib, "legacy_stdio_definitions.lib") // for printf, etc
35+
#elif defined(__GNUC__) || defined(__clang__)
36+
#define REB_RESTRICT __restrict__
37+
#else
3038
#define REB_RESTRICT restrict
39+
#endif
3140

32-
// Operating system specific options.
3341
// Windows requires special treatment.
3442
#ifdef _WIN64
3543
#define _LP64 // automatically defined on 64bit Linux and MacOS
3644
#endif // _WIN64
3745
#ifdef _WIN32
3846
#define _USE_MATH_DEFINES // Windows (MVSC) does not include math constants by default.
39-
#define REB_RESTRICT
4047
// Windows needs different declarations depending on whether the library is built or used.
4148
#ifdef BUILDINGLIBREBOUND
4249
#define REB_API __declspec(dllexport)
4350
#else
4451
#define REB_API __declspec(dllimport)
4552
#endif
46-
#ifdef _MSC_VER
47-
#pragma comment(lib, "legacy_stdio_definitions.lib") // for printf, etc
48-
#endif
4953
#endif // _WIN32
5054

5155
#include <stdlib.h> // for size_t
@@ -81,7 +85,7 @@ struct reb_particle {
8185
double az;
8286
double m; // Mass in code units
8387
double r; // Physical radius in code units
84-
const char* name; // Pointer to a NULL terminated string with the particle's name.
88+
const char* name; // Pointer to a NULL terminated string with the particle's name. Memory owned by simulation.
8589
#if !defined(_LP64)
8690
char pad2[4]; // Padding. ap is not padded to 8 bytes
8791
#endif

0 commit comments

Comments
 (0)