Skip to content

Commit

Permalink
feat: joined the macro conditional import std or named std module dep…
Browse files Browse the repository at this point in the history
…ending on the compiler
  • Loading branch information
TheRustifyer committed Aug 16, 2024
1 parent 186e77a commit 5b90503
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
26 changes: 12 additions & 14 deletions zero/ifc/commons/typedefs.cppm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @brief Provides a custom way of reexport common types and symbols typically
* found on some system headers in a convenient and encapsulated way.
*
*
* The main motivation of this module interface unit is to wrap all the system
* headers that has standard C++ typedefs, avoding the user to have to include
* on every file that is required those definitions, that also must be defined
Expand All @@ -14,45 +14,43 @@
* Defined in header <cstring>
* Defined in header <ctime>
* Defined in header <cuchar>
*
* Defined in header <cwchar> (since C++17)
*
* Defined in header <cwchar> (since C++17)
* ```
*/

export module typedefs;

#ifdef __clang__
#if defined(__clang__) || defined(_MSC_VER)
import std;
#elif defined(__GNUC__)
import <cstdio>;
#elif defined(_MSC_VER)
import std.core;
#endif

export namespace zero {
/**
* @brief `zero::size_t` is a typedef for wrapping the `std::size_t`, which is the unsigned integer type of the result
* @brief `zero::size_t` is a typedef for wrapping the `std::size_t`, which is the unsigned integer type of the result
* of the sizeof operator as well as the sizeof... operator and the alignof operator.
* The bit width of std::size_t is not less than 16.
* zero::size_t can store the maximum size of a theoretically possible object of any type (including array).
* A type whose size cannot be represented by zero::size_t is ill-formed. On many platforms
* A type whose size cannot be represented by zero::size_t is ill-formed. On many platforms
* (an exception is systems with segmented addressing) zero::size_t can safely store the value of any non-member pointer,
* in which case it is synonymous with std::uintptr_t.
* in which case it is synonymous with std::uintptr_t.
*/
typedef std::size_t size_t;

/**
* @brief zero::ptrdiff_t is a type alias for the std::ptrdiff_t,
* @brief zero::ptrdiff_t is a type alias for the std::ptrdiff_t,
* being the signed integer type of the result of subtracting two pointers.
*
* is used for pointer arithmetic and array indexing, if negative values are
* possible.
*
* is used for pointer arithmetic and array indexing, if negative values are
* possible.
* Programs that use other types, such as int, may fail on, e.g. 64-bit systems
* when the index exceeds INT_MAX or if it relies on 32-bit modular arithmetic
*
*
* Most common place of use if usually working with iterators, specially to fullfil
* the `difference_type` template argument
*/
Expand Down
2 changes: 1 addition & 1 deletion zork_config/zork_local_windows.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cpp_standard = "latest"
# extra_args = [ ]

[build]
output_dir = "./out"
output_dir = "out"

[targets.executable]
output_name = "zero"
Expand Down

0 comments on commit 5b90503

Please sign in to comment.