c++ - Are there any benefits of using constexpr over #define? -


this question has answer here:

you definetely know macros evil. relatively new keyword constexpr can few stuff couldn't const. e.g:

constexpr int getval() {     return 40; } int arr[getval()]; 

and yeah...there many other usages constexpr, in constructors..etc.

now question is, there benefit of using on #define macros?

edit

i know can , cannot done constexpr on macros of question , answers about. here i'm explicitly asking benefits of using constexpr on #define when both can used.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -