Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to have a positional addictional parameter ? #5

Open
MicioMax opened this issue Jul 18, 2017 · 0 comments
Open

Is it possible to have a positional addictional parameter ? #5

MicioMax opened this issue Jul 18, 2017 · 0 comments

Comments

@MicioMax
Copy link

MicioMax commented Jul 18, 2017

Hi,
What I'm trying to achieve is this :

`
const char _1[] PROGMEM = "This is a simple string array";
const char _2[] PROGMEM = "located in flash memory";
const char _3[] PROGMEM = "you can use it almost as a normal C character array";
const char _4[] PROGMEM = "just use 'FSArray(...)' macro to define it";
const char * const _5[] PROGMEM = { _1, _2, _3, _4, NULL };

FlashStringArray flashStringArray(_5);
`

Using something like that :

FlashStringArray flashStringArray = FSArray( "This is a simple string array", "located in flash memory", "you can use it almost as a normal C character array", "just use 'FSArray(...)' macro to define it" );

I guess that I'd need (at least!) the ability to have the MAP applied to a macro with 2 parameters, of which the second parameter is the "position" of argument inside variadic list. It would be possible to have a MAP_POS(F, ...) macro that applies F to all arguments, passing an additional, positional arg to it, i.e.
F(arg, pos), where 'pos' is a number or a _number ?

p.s.: I can't simply use const char * PROGMEM x[] = { "a", "b", .... } because compiler don't apply PROGMEM part to strings but just to pointers of them, so a variadic macro like that is the only solution.

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

No branches or pull requests

1 participant