Article View: comp.lang.c.moderated
Article #2559Re: Good C Interview questions?
From: Lawrence Kirby
Date: Tue, 09 Apr 1996 03:47
Date: Tue, 09 Apr 1996 03:47
26 lines
1855 bytes
1855 bytes
In article <4kbds7$eel@solutions.solon.com>
mholcomb@BIX.com "marty Holcomb" writes:
>Lawrence Kirby wrote:
>>The exact details are platform dependent. However the general approach for
>>minimising the structure size is widely applicable.
>>
>But you can't know how to minimize the size unless you know the specific
>platform.
You can't know for certain but the rules various platforms use for structure
padding are fairly consistent. If you group members of the same width together
and order widths in decreasing (or increasing if you like) size then you
have a reasonable chance of being optimal or close to optimal. The ordering
is implementation dependent - you don't know how say float compares with
long or how pointers fit in. Aggregate members are another issue. However
the *approach* is widely applicable even if the solution for a particular
platform may not be optimal for others. Knowing how to approach the problem
is what is important for an interview question (and indeed when you have to
solve the problem for real).
--
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------
Technical Details
Message-ID:
<4kcmk9$p1n@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<4k60f2$adp@solutions.solon.com> <4kbds7$eel@solutions.solon.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: Lawrence Kirby <fred@genesis.demon.co.uk> Newsgroups: comp.lang.c.moderated Subject: Re: Good C Interview questions? Date: 8 Apr 1996 22:47:21 -0500 Organization: none Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <4kcmk9$p1n@solutions.solon.com> References: <4k60f2$adp@solutions.solon.com> <4kbds7$eel@solutions.solon.com> Reply-To: fred@genesis.demon.co.uk NNTP-Posting-Host: solutions.solon.com X-NNTP-Posting-Host: genesis.demon.co.uk X-Newsreader: Demon Internet Simple News v1.27 X-Mail2News-Path: genesis.demon.co.uk