|
|
Up |
|
|
  |
Author: aarklonaarklon Date: Nov 15, 2007 10:49
Hi all,
I was going through the Book "The Hidden Treasure of C" by
Rajiv Dharaskar,First edition 1995, 2005 reprint,ISBN-81-7029-550-5
published in india by BPB publications
The following are my questions after going through the book
1)
#include
#include
#include
int
main (void)
{
register int i;
volatile int j;
auto int k;
time_t s1, s2, s3, e1, e2, e3;
|
| Show full article (2.54Kb) |
|
| | 15 Comments |
|
  |
|
|
  |
Author: Ben BacarisseBen Bacarisse Date: Nov 15, 2007 11:27
santosh gmail.com> writes:
> In article
> s19g2000prg.googlegroups.com>,
> aarklon@gmail.com gmail.com> wrote on Friday 16 Nov 2007 12:19
> am:
>
>> I was going through the Book "The...
|
| Show full article (1.40Kb) |
| no comments |
|
  |
Author: santoshsantosh Date: Nov 15, 2007 18:48
In article <87mytfs40i.fsf@bsb.me.uk>, Ben Bacarisse
wrote on Friday 16 Nov 2007 12:57 am:
> santosh gmail.com> writes:
>
>> In article
>> s19g2000prg.googlegroups.com>,
>> aarklon@gmail.com gmail.com> wrote on Friday 16 Nov 2007
...
|
| Show full article (1.50Kb) |
| no comments |
|
  |
Author: aarklonaarklon Date: Nov 15, 2007 19:01
On Nov 15, 2:06 pm, santosh gmail.com> wrote:
> In article
> s19g2000prg.googlegroups.com>,
> aark...@gmail.com gmail.com> wrote on Friday 16 Nov 2007 12:19
> am:
>
>
>
>> Hi all,
>
>> I was going through the Book "The Hidden Treasure of C" by
>> Rajiv Dharaskar,First edition 1995, 2005 reprint,ISBN-81-7029-550-5
>> published in india by BPB publications
>
>> The following are my questions after going through the book
>
>> 1)
>
>> #include
>> #include ...
|
| Show full article (2.71Kb) |
| no comments |
|
  |
Author: santoshsantosh Date: Nov 15, 2007 19:38
> On Nov 15, 2:06 pm, santosh gmail.com> wrote:
>> In article
>> s19g2000prg.googlegroups.com>,
>> aark...@gmail.com gmail.com> wrote on Friday...
|
| Show full article (3.95Kb) |
| no comments |
|
  |
Author: Keith ThompsonKeith Thompson Date: Nov 16, 2007 00:18
> I got the o/p as
> The time in seconds for register variable is 0.02
>
> The time in seconds for volatile variable is 0.01
>
> The time in seconds for auto variable is 0
>
> does this mean that accessing register variables is a slow
> operation...???
Those values are most likely within the margin of error (even if the
measurements are being done correctly).
> 2) why printf("\n ~5 = %%d",~5); is giving o/p as -6
> (how is 5 treated as an unsigned quantity or signed quantity)
>
> or by default how does the compiler treats numeric literals..??
|
| Show full article (4.25Kb) |
| no comments |
|
  |
Author: Christopher Benson-ManicaChristopher Benson-Manica Date: Nov 16, 2007 10:50
[comp.lang.c] Keith Thompson mib.org> wrote:
>> 3) why a global declaration such as register int i; is not
>> allowed.
> The original rationale, I suspect, is that tying up a CPU register
> (often a very scarce resource) for the entire lifetime of a program is
> undesirable.
Given that it's an ignorable suggestion rather than a command, I would
think that there might be some other explanation for disallowing the
construct.
--
C. Benson Manica | I appreciate all corrections, polite or otherwise.
cbmanica(at) gmail.com |
----------------------| I do not currently read any posts posted through
sdf.lonestar.org | Google groups, due to rampant unchecked spam.
|
| |
| no comments |
|
  |
Author: Keith ThompsonKeith Thompson Date: Nov 16, 2007 14:53
Keith Thompson wrote:
[...]
>> 3) why a global declaration such as register int i; is not
>> allowed.
>
> Because the standard says so.
>
> The original rationale, I suspect, is that tying up a CPU register
> (often a very scarce resource) for the entire lifetime of a program is
> undesirable. (On the other hand, declaring a register variable in
> main() does the same thing.)
>
> But in standard C, the "register" keyword doesn't necessarily mean that
> the variable is stored in a CPU register.
|
| Show full article (1.81Kb) |
| no comments |
|
  |
|
|
  |
Author: J. J. FarrellJ. J. Farrell Date: Nov 16, 2007 15:00
santosh wrote:
> In article <87mytfs40i.fsf@bsb.me.uk>, Ben Bacarisse
> wrote on Friday 16 Nov 2007 12:57 am:
>
>> santosh gmail.com> writes:
>>
>>> In article
>>> s19g2000prg.googlegroups.com>,
>>> aarklon@gmail.com gmail.com> wrote on Friday 16 Nov 2007
>>> 12:19 am:
>>>
>>>> I was going through the Book "The Hidden Treasure of C" by
>>>> Rajiv Dharaskar,First edition 1995, 2005 reprint,ISBN-81-7029-550-5
>>>> published in india by BPB publications
>>
>>>> for (i = 1; i <= 32000; i++)
>>>> e1 = clock ();
>>> Ridiculous nonsense.
>>>
>>>> printf ("\n The time in seconds for register variable is %%g\n", ...
|
| Show full article (1.68Kb) |
| no comments |
|
|
|
|