From: Philipp K. K. <pk...@sp...> - 2014-01-07 12:17:46
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 07.01.2014 12:58, schrieb Ben Shi: > Hello, > > The dumped AST info for int add(int a, int b) { int s = 1; s += a + > b; return s; } is > >> FUNCTION (_add=0x8b63770) type (int fixed) args (int fixed, int >> fixed) (null):0:{ L1 B0 (null):0: DECLARE SYMBOL (L1 B1 >> a=0x8b63138) type (int fixed) (null):0: DECLARE SYMBOL (L1 B2 >> s=0x8b61b28) type (int fixed) a.c:4: ASSIGN(=) (0x8b62cd0) type >> (int fixed) a.c:4: SYMBOL (L1 B2 s=0x8b62970 @ 0x8b61b28) type >> (int fixed) a.c:4: ADD (0x8b62c78) type (int fixed) a.c:4: >> SYMBOL (L1 B2 s=0x8b622b0 @ 0x8b61b28) type (int fixed) a.c:4: >> ADD (0x8b62918) type (int fixed) a.c:4: SYMBOL (L1 B1 >> a=0x8b625b8 @ 0x8b61018) type (int fixed) a.c:4: SYMBOL >> (L1 B1 b=0x8b628c0 @ 0x8b61398) type (int fixed) a.c:5: RETURN >> (0x8b63030) type (int fixed) a.c:5: SYMBOL (L1 B2 s=0x8b62fd8 >> @ 0x8b61b28) type (int fixed) (null):0:} > > But how is s initialized to 1 ? Should there be an ASSIGN(=) for > that ? > > Ben Looks to me as if s = 1; s += a + b; has already been replaced by s = 1 + (a + b); Philipp -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iEYEARECAAYFAlLL8FwACgkQbtUV+xsoLprycACfd6yvx+EICd80aT8ZSyrFr75V yBwAoKl2ASJO5wMMwKY1zCNVjQx4QR2a =4O4U -----END PGP SIGNATURE----- |