Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #146345

on gdb's sizeof versus gcc's sizeof

From Louis Valence <lvalence@example.com>
Newsgroups comp.lang.c
Subject on gdb's sizeof versus gcc's sizeof
Date 2019-09-25 22:03 -0300
Organization Aioe.org NNTP Server
Message-ID <867e5vkgw2.fsf@example.com> (permalink)

Show all headers | View raw


Can you explain this?  I don't get it.

%cat sizeof-long.c
#include <stdio.h>

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
%

Back to comp.lang.c | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

on gdb's sizeof versus gcc's sizeof Louis Valence <lvalence@example.com> - 2019-09-25 22:03 -0300
  Re: on gdb's sizeof versus gcc's sizeof Keith Thompson <kst-u@mib.org> - 2019-09-25 19:22 -0700
  Re: on gdb's sizeof versus gcc's sizeof scott@slp53.sl.home (Scott Lurndal) - 2019-09-26 13:26 +0000
    Re: on gdb's sizeof versus gcc's sizeof Keith Thompson <kst-u@mib.org> - 2019-09-26 13:08 -0700
      Re: on gdb's sizeof versus gcc's sizeof Louis Valence <lvalence@example.com> - 2019-09-28 16:57 -0300

csiph-web