Is 2 + 3 considered a literal?

Suppose I have something like

int x = 2 + 3;

Is it xconsidered a literal?

+3
source share
5 answers

x- symbol. 2 + 3- expression. 2and 3are literals.

+16
source

No, these are two literals in a compile-time constant expression. Depending on how it compiles, you may not be able to distinguish the resulting binary.

+9
source
  • int - ,
  • x - ,
  • = -
  • 2 -
  • + -
  • 3 -
  • ; -
+8

, . , ,

, ( , , ):

const unsigned int NEGATIVE_TESTER_FOR_32_BIT = 1 < < 31;

const char ALPHABET_PIVOT = 'A' + (('Z' - 'A')/2);

[EDIT: ] , . , , , - . "H", , verbatim "H" , (72 0x48 48h ) . , , . (-)

+1

Source: https://habr.com/ru/post/1744733/


All Articles