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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:34:51+00:00 2026-05-24T19:34:51+00:00

I was exploring C++0x today, and I encountered the new lambda feature. My question

  • 0

I was exploring C++0x today, and I encountered the new lambda feature. My question is how are these different (in terms of use) from blocks and why might one prefer one over the other?

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-05-24T19:34:53+00:00Added an answer on May 24, 2026 at 7:34 pm

    there is a a short syntax with C++0x lambdas to take every variable in
    scope by reference. ([&]) The type of a lambda is also unspecified,
    allowing potentially more optimal code.

    Now, when you look at Apple blocks, it will require __block specifiers
    added to variables you want to modify (the very fact that this is
    required suggests the whole system is defective). Variables are taken
    by reference but then by value when the block exits the scope (and the
    copied context necessarily lives on the heap, it seems). A weird
    semantic that will only lead to broken designs, but probably makes
    people that love GC happy. Without saying this probably has quite the
    efficiency cost, of course, since this requires special indirections.

    It is claimed the C++0x lambdas syntax would break compatibility with
    C programs, but I don’t think that is true. There are probably other
    problems to integrate it with C, though, mainly the fact that C can’t
    really deal with unspecified types and build type erasure.

    Apple blocks is really just an ObjC feature they try to generalize to
    other languages. For C++, the system designed for that language is
    just so much better.

    EDIT:

    To properly give credit, I took this information from http://www.rhinocerus.net/forum/language-c-moderated/558214-blocks-vs-c-lambdas.html a long time ago. That link is dead now; however, the original discussion appears to be archived here, thanks to @stefan for finding it.

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

Sidebar

Related Questions

After exploring the very excellent answer from Heike to my previous question about anamorphic
We're exploring different approaches for communicating between two different SQL Server instances. One of
I've been exploring different strategies for running integration tests within some Nant build scripts.
I've been exploring use of MSys lately as an alternative, 'nix-like shell for my
I started exploring Google Guice today to do dependency injection in my application. I
Exploring around S3's UI, it seems they only enjoy file uploads from my local
Today I was looking at some code atually from Nikhil Kothari's Facebook.NET API. I
Here’s a really really super-basic question. Say I wanted to build – today –
I will begin this question by admitting I am very new to MVC. The
I'm currently exploring the different options for building a not-too-complex web application, in which

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.