From: Steven Smith <sos22@cantab.net>
To: Vikas S <vikas_soolapani@yahoo.com>
Cc: Steve Graegert <graegerts@gmail.com>,
Rechberger Markus <mrechberger@gmail.com>,
linux-c-programming@vger.kernel.org, sos22@srcf.ucam.org
Subject: Re: Variable to sizeof function.
Date: Sat, 16 Jul 2005 09:26:40 +0100 [thread overview]
Message-ID: <20050716082640.GA1623@localhost> (raw)
In-Reply-To: <20050716064421.85333.qmail@web31901.mail.mud.yahoo.com>
[-- Attachment #1: Type: text/plain, Size: 691 bytes --]
> Thanks, This is a workable solution.
> But the issue is I've some 100+ structures. So, writing
> a if or case is going to be difficult.
>
> b) Yes. I want to pass a structure name. ie, make sizeof
> accept a variable.
You can't do this in C, but you might be able to achieve something
similar using gdb, if performance isn't important. If your
application is compiled with debug symbols, you can go ``inspect
sizeof(struct my_struct)'' from the gdb prompt, and get the number
you're looking for; you may be able to automate this.
If your application doesn't have debug symbols, then the information
you need isn't preserved by the compiler, so you're stuffed.
Steven.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2005-07-16 8:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-15 14:02 Variable to sizeof function Vikas S
2005-07-15 15:00 ` Vadiraj
2005-07-15 15:16 ` Rechberger Markus
2005-07-15 17:53 ` Vikas S
2005-07-15 22:35 ` Steve Graegert
2005-07-16 6:44 ` Vikas S
2005-07-16 7:04 ` Steve Graegert
2005-07-16 8:26 ` Steven Smith [this message]
2005-07-16 14:30 ` Eric Bambach
2005-07-17 16:27 ` Vadiraj
2005-08-01 6:10 ` Query in C avinash pawar
2005-08-01 6:44 ` Steve Graegert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050716082640.GA1623@localhost \
--to=sos22@cantab.net \
--cc=graegerts@gmail.com \
--cc=linux-c-programming@vger.kernel.org \
--cc=mrechberger@gmail.com \
--cc=sos22@srcf.ucam.org \
--cc=vikas_soolapani@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).