julelang / jule

Effective programming language to build efficient, fast, reliable and safe software while maintaining simplicity
https://jule.dev
BSD 3-Clause "New" or "Revised" License
128 stars 13 forks source link

[PROPOSAL] use`constexpr` instead of `inline constexpr` for functions #59

Closed vil02 closed 8 months ago

vil02 commented 8 months ago

Description

While browsing though the C++ code I have noticed that many functions have inline constexpr specifiers. According to C++ reference for constexpr: A constexpr specifier used in a function or static data member(since C++17) declaration implies inline.

Build and tests pass on my end.

Checklist

Screenshots (if any)

Note to reviewers

Make all inline constexpr functions constexpr.

mertcandav commented 8 months ago

Hi.

You are right, but Jule also supports C++14 standard. This changes still implements inline for C++14 standard? We can create preprocessor define for C++14 standard. If C++14 standard is used, this define represents inline, if not, represents nothing. So we can have inline for C++14 standard compilations.

Also, I think we can continue to use inline constexpr instead of constexpr if there is no problem (such as compiler errors or etc.) about it.

Thanks for your effort.

vil02 commented 8 months ago

This has nothing to do with the version of C++: constexpr function is inline in C++11, C++14, C++17 etc. (constexpr was introduced in C++11).

mertcandav commented 8 months ago

Right but reference says: constexpr implies inline for functions since C++17. So constexpr not implies inline in C++14, by reference.

vil02 commented 8 months ago

No.

Please have a look at the cpp reference. There are two statements here:

mertcandav commented 8 months ago

Oh, yes. Sorry. I just missed separated part for static members.

I'll merge your PR. Thanks for your contribution.

vil02 commented 8 months ago

No worries. The formatting there is tricky.

Thanks!