Skip to content

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

@MicioMax

Description

@MicioMax

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions