PPP2 Chapter 7, Section 7.6.1: const vs. constexpr

36 views
Skip to first unread message

John Q Smith

unread,
Dec 12, 2018, 11:07:21 AM12/12/18
to PPP-public

In Section 7.6.1 (page 232 of the 2nd edition), symbolic constants for number ('8'), quit ('q') and print (';') are defined as const.


Is there a reason for these to be defined as const rather than as constexpr? Wouldn't constexpr be more appropriate as these will never change during runtime?


I guess the compiler is interpreting them as constexpr, as (at least) number is being used as the target of a case in a switch statement.


[JQS]

Reply all
Reply to author
Forward
0 new messages