Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Ion conditional compilation #60

Open
tjpalmer opened this issue Jun 9, 2018 · 2 comments
Open

Ion conditional compilation #60

tjpalmer opened this issue Jun 9, 2018 · 2 comments

Comments

@tjpalmer
Copy link

tjpalmer commented Jun 9, 2018

Unless I've missed, ion currently has no conditional compilation. Tying that with some built-in consts for OS and such would be great. This requires falling out to c whenever this is needed, which is one place in the current ion compiler.

An implementation for this might possibly be tied up with some implementation of macros, if any.

(As an aside, I'm mostly against general compile time code execution, because I'm afraid of people getting carried away with it. But it's technically a potential solution for these sorts of things, too.)

@tjpalmer tjpalmer changed the title Conditional compilation Ion conditional compilation Jun 9, 2018
@Maykeye
Copy link

Maykeye commented Jun 10, 2018

Unless I've missed, ion currently has no conditional compilation. Tying that with some built-in consts for OS and such would be great

It does exactly that already: if you append e.g. _win32 to filename, during module compilation file will be compiled only if you compiling for windows.

The name is kinda a misnomer as it applies to both 32 and 64 bit versions of windows. There are also suffixes for choosing architecture. Look in system_packages/builtin/

@tjpalmer
Copy link
Author

Thanks for the tip! I'd managed to miss that this was a general feature in the compiler rather than specific handling for the builtins.

On not-necessarily-os issues, there's still a question of how to handle these kinds of things perhaps, though:

#ifndef MAX_PATH
#   if defined _MAX_PATH
#       define MAX_PATH _MAX_PATH
#   elif defined PATH_MAX
#       define MAX_PATH PATH_MAX
#   else
#       error "No suitable MAX_PATH surrogate"
#   endif
#endif

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants