Skip to content

Question: Naming of C macros #84

Closed
@nominolo

Description

@nominolo

I think for convenience we also want to implement not just the core intrinsics but also convenience macros. For example, there are a number of convenience macros around the _mm_getcsr intrinsic. For the following macro:

#define _MM_GET_EXCEPTION_MASK() (_mm_getcsr() & _MM_MASK_MASK)

In Rust, we would define the same thing as a function:

#[inline(always)]
#[target_feature = "+sse"]
pub unsafe fn _MM_GET_EXCEPTION_MASK() -> u32 {
    _mm_getcsr() & _MM_MASK_MASK;
}

But in Rust we normally wouldn't use all-uppercase for a function name. So, the question here is: Should we

  • use C naming convention for familiarity/compatibility with the C API, or
  • use Rust naming convention for Rust-internal consistency?

Personally, I'm leaning towards the second option (i.e., lower-case), because most search tools are case-insensitive, so anyone who knows the name will be able to find it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions