Skip to content

warning: cast from 'thrd_start_t' (aka 'int (*)(void *)') #58

@Cyrano61

Description

@Cyrano61

Hello Richard,

During compilation, I am encountering a warning that appears to be caused by a mix of POSIX threads (pthread_*) and C11 threads (<threads.h>).

It seems that some functions expecting int (*)(void *) are being passed to APIs expecting void ()(void *), and vice versa, leading to incompatible function pointer warnings.

Could you advise on the correct threading model to use, or how to resolve this mismatch?

MacOs
Apple clang version 17.0.0 (clang-1700.3.19.1)
Target: arm64-apple-darwin25.0.0
Thread model: posix

warning: cast from 'thrd_start_t' (aka 'int (*)(void *)')
to 'start_function' (aka 'void ()(void *)')
converts to incompatible function type [-Wcast-function-type-mismatch]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions