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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:47:34+00:00 2026-05-10T21:47:34+00:00

i did this in msvc 2005. typedef void (*cleanup_t)(); void func(cleanup_t clean) { cleanup_t();

  • 0

i did this in msvc 2005.

typedef void (*cleanup_t)();  void func(cleanup_t clean) {     cleanup_t(); } 

Why does this compile? and not give me a warning? ok, it gave me a unreferenced formal parameter warning but originally i did this when clean was in a class no there was no unreferenced formal parameter when this code gave me problems.

What is cleanup_t(); really doing and what is the point? now for laughs i tried int() and that worked also.

  • 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. 2026-05-10T21:47:35+00:00Added an answer on May 10, 2026 at 9:47 pm

    It’s executing a default initializer for the cleanup_t type to create a temporary of that type, and then never actually using that temporary.

    It’s a lot like a constructor call, the ‘MyClass()’ part of ‘MyClass c = MyClass();’, except that pointer-to-function types don’t actually have constructors. Of course in my code snippet here, ‘MyClass()’ doesn’t necessarily create a temporary, because it’s an initializer expression. The ‘MyClass()’ in ‘MyClass().some_method();’ is perhaps a closer analogy.

    ‘int()’ is another way of saying ‘int(0)’, which is another way of saying ‘(int)0’, which is another way of saying ‘0’. Again, it assigns to a temporary, and if that’s the whole statement then the temporary is unused.

    If you compile the code in the question with -Wall on GCC, you get a warning ‘statement has no effect’. The code a person doing this might have meant to type, ‘clean();’, wouldn’t produce that warning because of course it would have the effect of calling the function. Yet another reason to switch warnings on, and fix ’em properly 😉

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

Sidebar

Related Questions

First I did this - String str = {\hits\:[{\links_count\:6,\forum_count\:11}],\totalHitCount\:1}; Assert.assertTrue(str.matches({\hits\:[{\links_count\:[0-9]{1,},\forum_count \:11}],\totalHitCount\:[0-9]{1,}}), Partnership message does
I did this sort function in C++ for Linked List void sort() { node*
I did this tests and the results seems the count function scale linearly. I
I did this in the past, and can't remember the correct command (I think
i did this: this.combobox.ItemsSource = Common.Component.ModuleManager.Instance.Modules; to bind the combobox to a collection, which
I did this: [User.first, User.last].to_xml and got this: <users type=array> <user> <created-at type=datetime>2010-03-16T06:40:51Z</created-at> <id
HI i did this code with help of Marc Gravell in Why can't I
I'm running pylons and I did this: paster server development.ini It's running on :5000
I was playing around with recursion and did this simple function. I was assuming
Ok I know this is simple, in fact damn simple, I did this in

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.