Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6196507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:39:16+00:00 2026-05-24T03:39:16+00:00

WebKit has a lot of pre-processor lines like this: #if MACRO1(MACRO2) For example: #if

  • 0

WebKit has a lot of pre-processor lines like this:
#if MACRO1(MACRO2)

For example:

#if PLATFORM(MAC) || (PLATFORM(QT) && USE(QTKIT))
#include "MediaPlayerPrivateQTKit.h"
#if USE(AVFOUNDATION)
#include "MediaPlayerPrivateAVFoundationObjC.h"
#endif
...

So my first thought was that they were function-like macros, but I can’t see how that would work, and I couldn’t find any #defines for these macros anywhere in the source code.

I asked another engineer what it was and he’s never seen multiple macros used like that inside a #if before either.
I found this wiki page that talks about them but it still wasn’t clear to me where they come from,

So my question then: Is this valid C++ or is it being replaced in the code by another tool/language like CMake or something else, and if it is valid C++ is there a spec anyone is aware of that talks about this?

I’m a support engineer for a C++ Static Analysis tool that isn’t handling this syntax. A customer asked us to handle it, but if I’m going to take this to the senior engineer I’d like to not sound like an idiot 🙂 So I’d like the nitty gritty if anyone knows it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:39:17+00:00Added an answer on May 24, 2026 at 3:39 am

    As mentioned in the wiki, in root/trunk/Source/JavaScriptCore/wtf/Platform.h we get a definition for each of these defines. For instance, the PLATFORM macro is defined as:

    #define PLATFORM(WTF_FEATURE) \
           (defined WTF_PLATFORM_##WTF_FEATURE \
            && WTF_PLATFORM_##WTF_FEATURE)
    

    The value of WTF_FEATURE will be replaced by the platform name to create some macro named WTF_PLATFORM_WTF_FEATRE. For instance, with WTF_FEATURE passed into the macro as MAC, you would end up with a expansion of WTF_PLATFORM_MAC. The pre-processor defined directive combined with the logical AND is basically asking whether that macro value defined, and if it is defined, if its value is a “true” value. You would use this macro somewhere else in the pre-processor like:

    #ifdef __APPLE__
    #define WTF_PLATFORM_MAC 1
    #end if
    
    #define PLATFORM(WTF_FEATURE) \
           (defined WTF_PLATFORM_##WTF_FEATURE \
            && WTF_PLATFORM_##WTF_FEATURE)
    
    #if PLATFORM(MAC)
    //...some code
    #end if
    

    You wouldn’t use it within C++ code itself like

    if (PLATFORM(MAC))
    {
        //...some code
    }
    

    that would cause a bunch of errors from the compiler since defined is not a C++ keyword, and the evaluation and replacement of the macro within C++ code would end up dumping the defined pre-processor directive into any C++ code that directly called the macro. That’s not valid C++.

    Thanks you to Johannes for pointing out some of these issues.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given that Chrome and Safari use webkit has anyone yet found anything that renders
This may seem like a basic/stupid/obviously-answered question, but I wanted to check: why use
WebKit has introduced the ability to create CSS gradients. For example, with the following
Has anyone come across an effective way to mimic Webkit's -webkit-mask-box-image: url(filename.png) functionality? I'm
I was wondering if someone has already solved this. I have a SpringMVC app
I'd like to include a table in my web application thing that has a
I don't want to use WebKit .NET because it doesn't have some functionality that
I've got a Hybrid Cocoa/Webkit application that has extensive Javascript usage, and seems to
The Safari & Chrome developer tools (webkit inspector) seem to have become quite advanced.
My MacOsX has a Cocoa app with a special controller/window that employs WebKit for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.