Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • And what if I can't know the name of the variable ? Commented Jul 24, 2017 at 9:27
  • 2
    @Tom's What would be the context for that? Commented Jul 24, 2017 at 9:38
  • #define TEST_CONSTRUCTOR {.field1[0] = '\0', .field2 = .field1} used like test_s varname = TEST_CONSTRUCTOR. I know that i can do #define TEST_CONSTRUCTOR(varName) {.field1[0] = '\0', .field2 = varName.field1} but I wonder if not passing the variable name is possible. Commented Jul 24, 2017 at 9:45
  • @Tom's I tried a few things, but I can't think of an elegant way around passing variable name to your macro. Commented Jul 24, 2017 at 9:56
  • Thanks, it's logic I suppose. I will passing the variable name in my macro and be happy that a solution exist. Thank you ! Commented Jul 24, 2017 at 9:58