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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:34:30+00:00 2026-06-18T05:34:30+00:00

According to the Block_private.h file, whenever a block is declared in an Objective-c file,

  • 0

According to the Block_private.h file, whenever a block is declared in an Objective-c file, the following structures are created in the object file to represent it:

struct Block_descriptor {
    unsigned long int reserved;
    unsigned long int size;
    void (*copy)(void *dst, void *src);
    void (*dispose)(void *);
};

struct Block_layout {
    void *isa;
    int flags;
    int reserved; 
    void (*invoke)(void *, ...);
    struct Block_descriptor *descriptor;
    /* Imported variables. */
};

However, when I generate an assembly file, with clang -S ..., from

int(^squared)(int) = ^(int i) {
    return i*i;
};

I get the following snippet that represents the block:

    .type   .L.str210,@object       # @.str210
.L.str210:
    .asciz   "i12@?0i8"
    .size   .L.str210, 9

    .type   __block_descriptor_tmp,@object # @__block_descriptor_tmp
    .section    .rodata,"a",@progbits
    .align  16
__block_descriptor_tmp:
    .quad   0                       # 0x0
    .quad   32                      # 0x20
    .quad   .L.str210
    .quad   0
    .size   __block_descriptor_tmp, 32

    .type   __block_literal_global,@object # @__block_literal_global
    .align  8
__block_literal_global:
    .quad   _NSConcreteGlobalBlock
    .long   1342177280              # 0x50000000
    .long   0                       # 0x0
    .quad   __main_block_invoke
    .quad   __block_descriptor_tmp
    .size   __block_literal_global, 32

So, __block_literal_global and __block_descriptor_tmp are a Block_layout and a Block_descriptor, respectively. But, as you can see, the third field of __block_descriptor_tmp, which should be a void (*copy)(void *dst, void *src) according to Block_private.h, is a const char * that points to the block’s type encoding.

My question is: what does a block descriptor structure look like, exactly? Is my Block_private.h file deprecated, so that Block_descriptor implementation is currently different from the one I presented? If my file is right, why is the third field of __block_descriptor_tmp a const char *, not a void (*copy)(void *dst, void *src)?

  • 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-18T05:34:31+00:00Added an answer on June 18, 2026 at 5:34 am

    The copy and dispose helpers are only included if the block has captures that need to be managed (Practically speaking: objects & __block vars)

    If they are present then block->flags & BLOCK_HAS_COPY_DISPOSE

    Everything you need to know is outlined here: http://clang.llvm.org/docs/Block-ABI-Apple.html

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

Sidebar

Related Questions

According to the documentation : There is no way to block signals temporarily from
According to the C++11 standard, is the following program well-formed and portable C++? int
According this article , generic JPA DAO(Data Access Object) is a pretty nice pattern.
I would like to define smarty block names according to smarty data, but I
div is a block element and span is an inline element so according to
I want to remove the product_options_wrapper block from the product view page according to
According to this post , UDP just doesn't block. Are there any advantage using
According to the meteor docs, inserts block: On the server, if you don't provide
According to the sources I have read, dd block simply replaces newlines with spaces.
I am calling a block with a boolean value. According to the debugger, the

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.