Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]Where does Qt define the __VA_ARGS__ macro ?
Forum Updated to NodeBB v4.3 + New Features

[Solved]Where does Qt define the __VA_ARGS__ macro ?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stuartx
    wrote on 19 Aug 2012, 02:35 last edited by
    #1

    Hi, I want to define a variadic macro like:
    @#define LOG(fmt, ...) printf(fmt, ##VA_ARGS)@

    Both "##" and "VA_ARGS"can not pass the compiler. Does Qt support the variadic macro? If so, which header I should include?

    Thanks,

    Stuart

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on 19 Aug 2012, 07:47 last edited by
      #2

      Your compiler needs to support variadic macros. Qt can not make them work for you.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        stuartx
        wrote on 19 Aug 2012, 15:18 last edited by
        #3

        Tobias, you are right. The compiler, i.e. gcc, comes with the platform, not with the Qt. Thank you very much.

        I am using Mac OS X. I tried <stdio.h> and <stdarg.h>, no luck yet. Any one can tell me which header defines this "VA_ARGS" macro?

        Thanks,

        Stuart

        1 Reply Last reply
        0
        • S Offline
          S Offline
          stuartx
          wrote on 19 Aug 2012, 18:25 last edited by
          #4

          It turns out that I mistakenly try to use this "VA_ARGS" in a function directly.
          I examined that both of the following format work in Qt program:
          @#define LOG(fmt, ...) dbg_func(fmt, ##VA_ARGS)
          #define LOG(fmt, args...) dbg_func(fmt, ##args)@

          Sorry for the annoying.

          1 Reply Last reply
          0

          1/4

          19 Aug 2012, 02:35

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved