Path: csiph.com!aioe.org!.POSTED.H1GRgx8yu4o6KAw8I7gh/A.user.gioia.aioe.org!not-for-mail From: Louis Valence Newsgroups: comp.lang.c Subject: on gdb's sizeof versus gcc's sizeof Date: Wed, 25 Sep 2019 22:03:57 -0300 Organization: Aioe.org NNTP Server Lines: 36 Message-ID: <867e5vkgw2.fsf@example.com> NNTP-Posting-Host: H1GRgx8yu4o6KAw8I7gh/A.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (windows-nt) Cancel-Lock: sha1:0VvLapIr3Kg0UHhB9qDVZEF3cZ0= X-Notice: Filtered by postfilter v. 0.9.2 Xref: csiph.com comp.lang.c:146345 Can you explain this? I don't get it. %cat sizeof-long.c #include int main() { printf("sizeof unsigned long: %ld\n", sizeof (unsigned long)); printf("sizeof long: %ld\n", sizeof (long)); } %./sizeof-long sizeof unsigned long: 8 sizeof long: 8 %gdb GNU gdb (Ubuntu 8.0.1-0ubuntu1) 8.0.1 [...] (gdb) p sizeof (unsigned long) $1 = 4 (gdb) p sizeof (long) $2 = 4 (gdb) %uname -a Linux e 4.13.0-21-generic #24-Ubuntu SMP Mon Dec 18 17:29:16 UTC 2017 \ x86_64 x86_64 x86_64 GNU/Linux %lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 17.10 Release: 17.10 Codename: artful %