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

  • SEARCH
  • Home
  • 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 9216991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:32:22+00:00 2026-06-18T02:32:22+00:00

I’ve read the last C++11 draft (n3337 – is it the last one?), and

  • 0

I’ve read the last C++11 draft (n3337 – is it the last one?), and I got a question for a possible implementation I’ve been working on.

Let’s say we have this code:

extern "Objective C" {
  class Object {
    public:
      static Object *alloc();
      Object *init();
  };
};

Then calling

Object *x = Object::alloc()->init();

The question is that I didn’t understand if it is allowed for the compiler to control the calling convention of extern “X” blocks: the idea would be to “translate” the calls to objc_msgSend(blablabla) – would that be conformant to the standard, or would it be considered an extension (since it wouldn’t just modify the symbol name, but as well as a complex “calling convention” here)? Of course I could implement this by making a weak function that is called as __thiscall and then calls and returns the method itself – but the question continues, would it be conformant?

Thanks!

  • 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-06-18T02:32:24+00:00Added an answer on June 18, 2026 at 2:32 am

    Everything you describe sounds to be in line with the intent of the language linkage feature.

    Class members are specifically excluded from "C" language linkage. According to examples in the Standard (C++11 §7.5/4), function pointer types within class member declarations, extern declarations in any context, and all other function declarations do inherit the enclosing extern "C" {} block. You’re defining a language linkage besides "C" but it would be least surprising to follow its example, perhaps with extra mapping between this and self.

    The requirements are open, according to §7.5/2:

    Use of a string-literal other than “C” or “C++” is conditionally-supported, with implementation-defined semantics. [ Note: Therefore, a linkage-specification with a string- literal that is unknown to the implementation requires a diagnostic. — end note ] [ Note: It is recommended that the spelling of the string-literal be taken from the document defining that language. For example, Ada (not ADA) and Fortran or FORTRAN, depending on the vintage. — end note ]

    You could switch to a completely different language within the braces an it would be alright. (Although, grammatically, I suppose everything should parse as a C++ declaration or declaration-seq.)

    According to that, though, you should use extern "Objective-C" with a hyphen since the definitive document’s title is “The Objective-C Programming Language.”

    EDIT: To be sure, calling through objc_msgSend doesn’t affect anything that the Standard specifies. Nowhere does it say how C++ functions are called. The added intermediate function is just machine-level instructions, beyond language semantics, and no different from the special instructions used to call into Pascal, Fortran, etc., e.g. by altering the order of parameters on the stack. I don’t mean to compare your scheme to “switching to a completely different language within the braces,” just to emphasize that there’s plenty of headroom.

    Taking the extern "C" specification in the Standard as an example, it breaks a lot of things by fundamentally changing the ODR rule because C isn’t required to support any mangling. So your scheme is allowed to break at least that much.

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

Sidebar

Related Questions

Let's say I'm outputting a post title and in our database, it's Hello Y’all
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I have a text area in my form which accepts all possible characters from
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have been unable to fix a problem with Java Unicode and encoding. The
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
i got an object with contents of html markup in it, for example: string

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.