GithubHelp home page GithubHelp logo

Macro concat error about runtime HOT 7 CLOSED

sqfvm avatar sqfvm commented on June 15, 2024
Macro concat error

from runtime.

Comments (7)

dedmen avatar dedmen commented on June 15, 2024
@SQF#3423 
#define QUOTE(x) #x
#define MODULE ACE_medical
#define QGVAR(x) QUOTE(MODULE##x)
#define HIT_STRUCTURAL QGVAR($#structural)
[HIT_STRUCTURAL, 0]

Actual:
[WORK] <ARRAY> ["ACE_medical#$#structural",0]
Expected:
[WORK] <ARRAY> ["ACE_medical$#structural",0]

from runtime.

X39 avatar X39 commented on June 15, 2024

The expected result actually is invalid:
Input File

#define QUOTE(x) #x
#define QGVAR(x) QUOTE(ace_test_##x)
#define HIT_STRUCTURAL QGVAR($#structural)
HIT_STRUCTURAL
#define QUOTE2(x) #x
#define QGVAR2(x) QUOTE2(#x)
#define HIT_STRUCTURAL2 QGVAR2($#structural)
HIT_STRUCTURAL2

Output File

#line 1 "C:\Users\marco.silipo\Documents\Arma 3 - Other Profiles\X39\missions\test.VR\pptest2.c"



"ace_test_##$#structural"



"#$#structural"

from runtime.

X39 avatar X39 commented on June 15, 2024

Still, fixed in 9a198e9 (according to arma)

from runtime.

dedmen avatar dedmen commented on June 15, 2024

The expected result actually is invalid:

You used different code.

#define QGVAR(x) QUOTE(ace_test_##x)

vs

#define MODULE ACE_medical
#define QGVAR(x) QUOTE(MODULE##x)
#define QUOTE2(x) #x
#define QGVAR2(x) QUOTE2(#x)
#define HIT_STRUCTURAL2 QGVAR2($#structural)
HIT_STRUCTURAL2

Why are you forcing a # to the start using QUOTE2? That's not what my code did.

from runtime.

X39 avatar X39 commented on June 15, 2024

Double read, just accidentially copied the second Part too 🙈

from runtime.

X39 avatar X39 commented on June 15, 2024

Ahh, now I See, you talk about the second comment you made
Is second still not working as expected I guess?

from runtime.

dedmen avatar dedmen commented on June 15, 2024

Both my reproduction code examples where wrong.

#define QGVAR(x) QUOTE(ace_test_##x)
#define QGVAR(x) QUOTE(MODULE##x)
Doesn't work as concat inside a argument for another macro is not evaluated before the sub-macro is called.

Here is real reproduction of the whole macro chain without ommiting parts for simplicity and breaking it because I don'tu understand how the preproc works

#define QUOTE(x) #x
#define PREFIX ACE
#define COMPONENT medical
#define DOUBLES(var1,var2) ##var1##_##var2
#define ADDON DOUBLES(PREFIX,COMPONENT)
#define GVAR(var1) DOUBLES(ADDON,var1)
#define QGVAR(var1) QUOTE(GVAR(var1))
#define HIT_STRUCTURAL QGVAR($#structural)
entry = HIT_STRUCTURAL

That would be example for a config.

from runtime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.