Re: Defined string with 4 characters is sizeof 4 in watch and 5 in compiled code.
| Newsgroups | gmane.comp.hardware.texas-instruments.msp430.discuss |
|---|---|
| Message-ID | <01e501cf9fc1$c4af6fd0$d5c0a8c0@wizardsdomain> |
Strings include a NUL character as the string terminator. So that would be 4+1 ----- Original Message ----- From: [email protected] [msp430] To: [email protected] Sent: Monday, July 14, 2014 16:38 Subject: [msp430] Defined string with 4 characters is sizeof 4 in watch and 5 in compiled code. So, just out of curiosity, how can sizeof(LOGGER_SERIAL_DEFAULT) be both 4 (in the QuckWatch) and 5 in the compiled code (red line in disassembly) ? It's defined as: #define LOGGER_SERIAL_DEFAULT "----" So in my mind it should be 4 (if the compiler wanted to count the quotes it would be 6) but NEVER 5. http://e2e.ti.com/cfs-file.ashx/__key/communityserver-discussions-components-files/166/0552.delme.png http://e2e.ti.com/cfs-file.ashx/__key/communityserv... View on e2e.ti.com Preview by Yahoo