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 614089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:04:28+00:00 2026-05-13T18:04:28+00:00

I’ve never quite understood how the argument lists for operator overloading are determined in

  • 0

I’ve never quite understood how the argument lists for operator overloading are determined in a systematic way, and I’m particularly confused by a problem I have now.

When you overload a unary operator it has one argument, or zero if it’s a class member. When you overload a binary operator it has two arguments, or one if it’s a class member. At least that’s the way it would seem to work. I’m having a problem with operator new (not a class member) however.

In a codebase I’m working in, as in other places I have seen in the past (like here for example) there is a define like #define new new(__FILE__, __LINE__) and a corresponding function with the signature void *new(size_t size, const char *file, unsigned line) or something like it for memory debugging. I note that the one in my project is actually different from the previously linked one. This presents a problem for me, because for some reason it’s messing up a placement new. I’ve looked in The C++ Programming Language, and if it explains this I’m missing it.

Is new special in this regard, i.e. does it have specific language defined extra debug signatures? It doesn’t seem like it because, as I noted above, I’ve seen slightly different signatures in different places. If it does, what other operators have non-obvious signatures, and what are they? Are these varied signatures instead some implementation specific extras? If so, are there any general rules as to what most implementations do? Alternatively, is it an arity issue like I implied in my title? Can you just tack on as many extra arguments as you want in the signature and if you call new with the arguments between the new keyword itself and the new type you want you can just do whatever? Or am I even more confused, and there’s something else I’m missing?

Most importantly in the short term (although I’d really like to understand this), what’s going on the messes up my placement new? The macro is causing an expansion something like new ("file.cpp", 100) (class_pointer) class_t. Is the problem the two groups in parenthesis maybe, or something else?

  • 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-13T18:04:28+00:00Added an answer on May 13, 2026 at 6:04 pm

    The arity of an overloaded operator is whatever you declare. For the operators named after symbols (+), if you define them to have extra args, they will only be invoked via an explicit call. (operator +(a, b, c, d, e)). For operator new, you must give it at least one arg, but you may give it as many as you want. Regular operator overloading determines which one gets called.

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

Sidebar

Ask A Question

Stats

  • Questions 375k
  • Answers 375k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Count street's string length and then add/remove left padding of… May 14, 2026 at 8:21 pm
  • Editorial Team
    Editorial Team added an answer Now, I don't know about onTouchEvent short circuiting onClick, and… May 14, 2026 at 8:21 pm
  • Editorial Team
    Editorial Team added an answer This should work for you: > lof[grep("layer1_.*.grd", lof)] [1] "layer1_1.grd"… May 14, 2026 at 8:21 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.