H
Hicham Mouline
Hello,
we have been using an int type for both dates in the format YYYYMMDD and
number of days to some date.
We've had issues where both types got mixed at runtime.
We're looking for a simple C++ fix to this if there is, something like:
struct Date {
int i;
};
struct Days {
int i;
};
void f( Date d );
....
const Days d = { 15 };
f( d ); // compile-error
This would help detect at compile-time errors like these.
Is there a runtime cost of using struct instead of int, in these cases?
regards,
we have been using an int type for both dates in the format YYYYMMDD and
number of days to some date.
We've had issues where both types got mixed at runtime.
We're looking for a simple C++ fix to this if there is, something like:
struct Date {
int i;
};
struct Days {
int i;
};
void f( Date d );
....
const Days d = { 15 };
f( d ); // compile-error
This would help detect at compile-time errors like these.
Is there a runtime cost of using struct instead of int, in these cases?
regards,