Friday, March 26, 2010

comp.lang.c - 26 new messages in 10 topics - digest

comp.lang.c
http://groups.google.com/group/comp.lang.c?hl=en

comp.lang.c@googlegroups.com

Today's topics:

* Declaring an external variable as a struct - 3 messages, 3 authors
http://groups.google.com/group/comp.lang.c/t/9fba63a8c39a512b?hl=en
* 16:32 far pointers in OpenWatcom C/C++ - 10 messages, 5 authors
http://groups.google.com/group/comp.lang.c/t/4728dadef590aafe?hl=en
* Is it good to use char instead of int to save memory? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/40bfc7048b74630b?hl=en
* Containers: The iterator object - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/662f02788cfa0c97?hl=en
* Has thought been given given to a cleaned up C? Possibly called C+. - 2
messages, 2 authors
http://groups.google.com/group/comp.lang.c/t/5954dc70a43f9f8e?hl=en
* How should I test for a null pointer? - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c/t/ac6fdf22358cde1a?hl=en
* ◆⊙◆ 2010 Prada handbags get low price wholesale (http://www.rijing-trade.com)
<paypal payment> - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/188bc1107e38337e?hl=en
* Container library (continued) - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/3763649cc890efcc?hl=en
* Cheap Wholesale 10DEEP Coat Christan Audigier Coat Armani Scarf Paul Smith
Scarf FREE SHIPPING<www.vipchinatrade.com> - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/7339a83e7613288b?hl=en
* Behavior of if construct in switch case defualt construct. - 4 messages, 3
authors
http://groups.google.com/group/comp.lang.c/t/83b500624be615ca?hl=en

==============================================================================
TOPIC: Declaring an external variable as a struct
http://groups.google.com/group/comp.lang.c/t/9fba63a8c39a512b?hl=en
==============================================================================

== 1 of 3 ==
Date: Thurs, Mar 25 2010 11:51 pm
From: Ian Collins


On 03/26/10 06:01 PM, Mark Hobley wrote:
> Ian Collins<ian-news@hotmail.com> wrote:
>>> buffers.h also defines another structure:
>>>
>>> struct bufstru {
>>> char *addr;
>>> int sz;
>>> int ptr;
>>> int tail;
>>> };
>>>
>>> In buffer.c, I have a function dynalloc as follows:
>>>
>>> int dynalloc(struct bufstru *buffer) {
>>> flag err = FALSE;
>>> if (buffer.addr == NULL) {<--- This line gives an error
>>
>> As it should, butter is a pointer to a bufstru, no a bufstru. Use
>>
>> buffer->addr == NULL
>
> Sorry Ian. My bad C is misleading you. That is not my intention.
>
> struct bufstru {
> char *addr;
> int sz;
> int ptr;
> int tail;
> };
>
> int dynalloc(struct bufstru *buffer);
>
> buffer is a structure of type bufstru whose address is passed as a parameter
> to dynalloc. (I am also guessing here that the structure would be passed by
> reference, rather than via the stack, making the function dynalloc capable of
> changing the values in the pointed at structure, rather than in the stack
> variable, so that the values are not lost when the function returns. At least,
> that is my intention.)

C doesn't have pass by reference. Passing a pointer is as close as you
can get.

> The element buffer.addr of the pointed at structure will point to a newly
> allocated dynamic buffer which will subsequently be used by various string
> manipulation processes.

But as I said, butter is a pointer to a bufstru, no a bufstru.

<snip>

> Maybe I got the prototype wrong.
>
> int dynalloc(struct bufstru *buffer);
>
> Do I pass the structure type in a prototype?

You pass a pointer to the structure.

--
Ian Collins


== 2 of 3 ==
Date: Fri, Mar 26 2010 12:40 am
From: markhobley@hotpop.donottypethisbit.com (Mark Hobley)


Ian Collins <ian-news@hotmail.com> wrote:

> You pass a pointer to the structure.

This is what I am trying to do. I do not understand why struct bufstru *
is not a pointer to a bufstru structure in the context of the prototype.

int dynalloc(struct bufstru *buffer);

Doesn't the star mean that this a pointer?

Mark.

--
Mark Hobley
Linux User: #370818 http://markhobley.yi.org/

== 3 of 3 ==
Date: Fri, Mar 26 2010 1:26 am
From: Nick Keighley


On 26 Mar, 07:40, markhob...@hotpop.donottypethisbit.com (Mark Hobley)
wrote:
> Ian Collins <ian-n...@hotmail.com> wrote:
> > You pass a pointer to the structure.
>
> This is what I am trying to do. I do not understand why struct bufstru *
> is not a pointer to a bufstru structure in the context of the prototype.
>
> int dynalloc(struct bufstru *buffer);
>
> Doesn't the star mean that this a pointer?

yes. But you aren't /using/ it as pointer. This would be easier if you
left more context in your posts.

Get a good tutorial such as K&R

==============================================================================
TOPIC: 16:32 far pointers in OpenWatcom C/C++
http://groups.google.com/group/comp.lang.c/t/4728dadef590aafe?hl=en
==============================================================================

== 1 of 10 ==
Date: Fri, Mar 26 2010 12:09 am
From: Phil Carmody


Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> Phil Carmody <thefatphil_demunged@yahoo.co.uk> writes:
>> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>>> Phil Carmody <thefatphil_demunged@yahoo.co.uk> writes:
>>>> Seebs <usenet-nospam@seebs.net> writes:
>>>>> On 2010-03-24, Keith Thompson <kst-u@mib.org> wrote:
>>>>>> Ahem A Rivet's Shot <steveo@eircom.net> writes:
>>>>>>> It doesn't have to be a typedef - it usually is but it doesn't have
>>>>>>> to be.
>>>>>
>>>>>> How could size_t not be a typedef? It's not a keyword or a macro.
>>>>>
>>>>> It could, however, be treated magically by the compiler.
>>>>>
>>>>> Which means that, while it appears to necessarily have the same semantics
>>>>> as a typedef, there's no requirement that it actually *is* one.
>>>>
>>>> It has to be a 'type' which has a 'corresponding signed type',
>>>
>>> I can't find this requirement. Where does it come from?
>>
>> Ref posted elsethread, but it was the description of printf's %z.
>
> That allows for the possibility. You say its existence is required.
> That's the bit I can't find.

The use of the word "the", and lack of additional weasel wording,
implies it. If they'd chosen the word "any", then it wouldn't have
implied it.

> The standard permits extensions and I take that to include extensions
> to the ways types are defined and declared. Obviously you don't.
> Does it matter?

Not particulary. However, the standard does mention many properties
of how the standard headers refer to size_t, and I think they should
be satisfied verbatim.

Phil
--
I find the easiest thing to do is to k/f myself and just troll away
-- David Melville on r.a.s.f1


== 2 of 10 ==
Date: Fri, Mar 26 2010 12:32 am
From: Phil Carmody


Branimir Maksimovic <bmaxa@hotmail.com> writes:
> Nick Keighley <nick_keighley_nospam@hotmail.com> wrote:
>> On 25 Mar, 13:20, Branimir Maksimovic <bm...@hotmail.com> wrote:
...
>> > Obviously not. I claim that everything runs sluggish when
>> > OS have to employ swapping. In this case problem is
>> > GC as it scans (*all memory for references*)
>> > thus forcing heavy swaping. You don;t have such
>> > problems with malloc/free.
>>
>> look up "generational garbage collection"
>
> Same problem. GC has to scan whole heap all the time,
> in order to catch newly allocated references.

Nonsense. It has to scan all the memory which is referencable.
That's a subset of all the memory which is allocated, which
is a subset of all the so-called heap.

If you fill memory with a single long linked list, and then
forget the head pointer, none of the memory used for the list
needs to be scanned.

Phil
--
I find the easiest thing to do is to k/f myself and just troll away
-- David Melville on r.a.s.f1


== 3 of 10 ==
Date: Fri, Mar 26 2010 1:03 am
From: Nick Keighley


On 25 Mar, 18:59, Branimir Maksimovic <bm...@hotmail.com> wrote:
> On Thu, 25 Mar 2010 19:57:18 +0100
> Branimir Maksimovic <bm...@hotmail.com> wrote:

> > If you want to interface with other language or even other
> > C++ compiler that most go through C interface.
>
> that must go through C interface.
>
> > Also global new can be overloaded that can make lot of problems.
> > For example in microsoft environment if you link with MFC
> > it will [throw] some non standard exception, if not linked with MFC,
> > it will return [null].

it's not a conforming implementation then

== 4 of 10 ==
Date: Fri, Mar 26 2010 1:13 am
From: Nick Keighley


On 26 Mar, 01:31, nob...@xmission.com (Scott) wrote:
> On Thu, 25 Mar 2010 11:30:13 -0700, in comp.lang.c, Keith Thompson
> <ks...@mib.org> wrote:
> >Branimir Maksimovic <bm...@hotmail.com> writes:

> >> use malloc but always new. I don;t think that's realistic.
> >> You can;t always use new and malloc is no the
> >> only one void* situation.
>
> >How is that unrealistic?  new and delete are built into the C++
> >language.  Why would you not use them?
>
> When I learned C++, I was told that there isn't an equivalent of realloc
> that operates on a new'd pointer.  I use realloc a lot.

the idea of an expandable object probably seems a bit odd. You could
hide your malloc/realloc/free inside some object.

Or as Keith says, use std::vector


> (I thought that C++ might have acquired an equivalent to realloc in the many
> years since I learned the language, but a quick web search says not; the
> standard response to the question seems to be "don't do that".  So grows the
> list of reasons I code in C, and not C++.)

== 5 of 10 ==
Date: Fri, Mar 26 2010 1:06 am
From: Sol-Terrasa mkfs ext4 da' Sussex


On Fri, 2010-03-26 at 01:31 +0000, Scott wrote:
> When I learned C++, I was told that there isn't an equivalent of
> realloc that operates on a new'd pointer. I use realloc a lot.

You don't need realloc in C++ because some of the data types provided
can dynamically allocate more memory when needed, i.e. std::vector<>
--
http://www.munted.org.uk

One very high maintenance cat living here.

== 6 of 10 ==
Date: Fri, Mar 26 2010 3:23 am
From: Branimir Maksimovic


On Fri, 26 Mar 2010 09:32:44 +0200
Phil Carmody <thefatphil_demunged@yahoo.co.uk> wrote:

> Branimir Maksimovic <bmaxa@hotmail.com> writes:
> > Nick Keighley <nick_keighley_nospam@hotmail.com> wrote:
> >> On 25 Mar, 13:20, Branimir Maksimovic <bm...@hotmail.com> wrote:
> ...
> >> > Obviously not. I claim that everything runs sluggish when
> >> > OS have to employ swapping. In this case problem is
> >> > GC as it scans (*all memory for references*)
> >> > thus forcing heavy swaping. You don;t have such
> >> > problems with malloc/free.
> >>
> >> look up "generational garbage collection"
> >
> > Same problem. GC has to scan whole heap all the time,
> > in order to catch newly allocated references.
>
> Nonsense. It has to scan all the memory which is referencable.
> That's a subset of all the memory which is allocated, which
> is a subset of all the so-called heap.
>
> If you fill memory with a single long linked list, and then
> forget the head pointer, none of the memory used for the list
> needs to be scanned.

Problem is that you don't know *where* in the heap is first
pointer neither you don;t know about any user data structure
employed.
All you know about is cyclic graph of references *everywhere*
in the heap. And user can assign references you know.
So situation can drastically change whenever,
yo have to scan.
Problem is that there can be *many* references to
root node in pointer graph. Whenever user
assigns reference to root node, you don;t know
in *which* node is that reference.

Greets

--
http://maxa.homedns.org/

Sometimes online sometimes not


== 7 of 10 ==
Date: Fri, Mar 26 2010 3:28 am
From: Branimir Maksimovic


On Fri, 26 Mar 2010 01:03:55 -0700 (PDT)
Nick Keighley <nick_keighley_nospam@hotmail.com> wrote:

> On 25 Mar, 18:59, Branimir Maksimovic <bm...@hotmail.com> wrote:
> > On Thu, 25 Mar 2010 19:57:18 +0100
> > Branimir Maksimovic <bm...@hotmail.com> wrote:
>
> > > If you want to interface with other language or even other
> > > C++ compiler that most go through C interface.
> >
> > that must go through C interface.
> >
> > > Also global new can be overloaded that can make lot of problems.
> > > For example in microsoft environment if you link with MFC
> > > it will [throw] some non standard exception, if not linked with
> > > MFC, it will return [null].
>
> it's not a conforming implementation then
>

It is not conforming, but real, you have to deal with it.

Greets!

--
http://maxa.homedns.org/

Sometimes online sometimes not


== 8 of 10 ==
Date: Fri, Mar 26 2010 3:34 am
From: Branimir Maksimovic


On Fri, 26 Mar 2010 11:23:34 +0100
Branimir Maksimovic <bmaxa@hotmail.com> wrote:

> On Fri, 26 Mar 2010 09:32:44 +0200
> Phil Carmody <thefatphil_demunged@yahoo.co.uk> wrote:
>
> > Branimir Maksimovic <bmaxa@hotmail.com> writes:
> > > Nick Keighley <nick_keighley_nospam@hotmail.com> wrote:
> > >> On 25 Mar, 13:20, Branimir Maksimovic <bm...@hotmail.com> wrote:
> > ...
> > >> > Obviously not. I claim that everything runs sluggish when
> > >> > OS have to employ swapping. In this case problem is
> > >> > GC as it scans (*all memory for references*)
> > >> > thus forcing heavy swaping. You don;t have such
> > >> > problems with malloc/free.
> > >>
> > >> look up "generational garbage collection"
> > >
> > > Same problem. GC has to scan whole heap all the time,
> > > in order to catch newly allocated references.
> >
> > Nonsense. It has to scan all the memory which is referencable.
> > That's a subset of all the memory which is allocated, which
> > is a subset of all the so-called heap.
> >
> > If you fill memory with a single long linked list, and then
> > forget the head pointer, none of the memory used for the list
> > needs to be scanned.
>
> Problem is that you don't know *where* in the heap is first
> pointer neither you don;t know about any user data structure
> employed.
> All you know about is cyclic graph of references *everywhere*
> in the heap. And user can assign references you know.
> So situation can drastically change whenever,
> yo have to scan.
> Problem is that there can be *many* references to
> root node in pointer graph. Whenever user
> assigns reference to root node, you don;t know
> in *which* node is that reference.
>
And all that is about mark and sweep collector.
What about compacting collector?!
It has to update (*all references* in application)
after move to new location!
That;s tremendous overhead you can;t optimize
in now way!

Greets!

--
http://maxa.homedns.org/

Sometimes online sometimes not


== 9 of 10 ==
Date: Fri, Mar 26 2010 4:27 am
From: jmfbahciv


Joe Pfeiffer wrote:
> jmfbahciv <jmfbahciv@aol> writes:
>
>> Branimir Maksimovic wrote:
>>> Obviously not. I claim that everything runs sluggish when
>>> OS have to employ swapping.
>> You are wrong.
>
> I think his claim isn't that enabling swap forces things to run slow,
> but that doing lots of pagein/pageout does. That latter claim, of
> course, is true.

Oh, I didn't read it that way. If the app is doing a lot of
page I/O, there is a problem with the app, not the monitor.

>
>>> In this case problem is
>>> GC as it scans (*all memory for references*)
>>> thus forcing heavy swaping. You don;t have such
>>> problems with malloc/free.
>> It sounds like you have a lot more to learn about how
>> code works and doesn't work.
>
> Well, GC does have to come close to scanning all the allocated memory of
> a process.

/BAH


== 10 of 10 ==
Date: Fri, Mar 26 2010 4:32 am
From: jmfbahciv


Branimir Maksimovic wrote:
> On Thu, 25 Mar 2010 09:18:42 -0500
> jmfbahciv <jmfbahciv@aol> wrote:
>
>> Branimir Maksimovic wrote:
>>> On Thu, 25 Mar 2010 08:32:52 -0500
>>> jmfbahciv <jmfbahciv@aol> wrote:
>>>
>>>> Branimir Maksimovic wrote:
>>>>> On Thu, 25 Mar 2010 01:47:34 +0200
>>>>> Phil Carmody <thefatphil_demunged@yahoo.co.uk> wrote:
>>>>>
>>>>>> Branimir Maksimovic <bmaxa@hotmail.com> writes:
>>>>>>> Joe Pfeiffer <pfeiffer@cs.nmsu.edu> wrote:
>>>>>>>> No, a very small fraction of the virtual address space is
>>>>>>>> mapped to physical RAM.
>>>>>>> Hm , why then people have problem with Linux OOM killer,
>>>>>> Because they are using vastly more virtual address space
>>>>>> than there is physical RAM.
>>>>>> Which kinda follows from what
>>>>>> Joe already said.
>>>>> Yes, but you have to know how much GB of swap to enable.
>>>>> Besides that then everything runs sluggish.
>>>>>
>>>> Huh? Are you stating that the system goes sluggish when
>>>> you turn swapping on?
>>>>
>>> Obviously not. I claim that everything runs sluggish when
>>> OS have to employ swapping.
>> You are wrong.
>
> Only if SAN is used, Im wrong, but on two disks in RAID1,
> setup hm .

Joe pointed out that I misread your comment.
>
>>> In this case problem is
>>> GC as it scans (*all memory for references*)
>>> thus forcing heavy swaping. You don;t have such
>>> problems with malloc/free.
>> It sounds like you have a lot more to learn about how
>> code works and doesn't work.
>
> Educate me then.
>
We're all trying ;-).

/BAH

==============================================================================
TOPIC: Is it good to use char instead of int to save memory?
http://groups.google.com/group/comp.lang.c/t/40bfc7048b74630b?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 26 2010 12:36 am
From: Dr Malcolm McLean


On 25 Mar, 06:54, Tim Rentsch <t...@x-alumni2.alumni.caltech.edu>
wrote:
> Dr Malcolm McLean <malcolm.mcle...@btinternet.com>
> > void zeroduplicates(UBIG *x, USMALL N)
> > {
> >   USMALL i;
> >   for(i=0;i<N-1;i++)
> >     if(x[i] == x[i+1])
> >       x[i] = 0;
> > }
>
> > it's hard to spot the bug.
>
> Hard to spot the bug?  Not hard at all -- the bug is
> that the code should never have made it out of code
> review.
>
I've nothing against code reviews. As you say, review ought to pick up
mistakes like this. But not everyone does reviews, and the reviews are
only as good as the people doing the reviewing. (In practice they
don't eliminate all bugs, or the software crisis would be solved).

If you tell someone that a four-line fragment of code has a bug, and
they fail to spot it, I think we can reasonably conclude that the bug
is hard to spot.

==============================================================================
TOPIC: Containers: The iterator object
http://groups.google.com/group/comp.lang.c/t/662f02788cfa0c97?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 26 2010 1:03 am
From: Phil Carmody


Tim Rentsch <txr@x-alumni2.alumni.caltech.edu> writes:
> Andrew Poelstra <apoelstra@localhost.localdomain> writes:
>> I agree. It's Bad Polymorphism if you have an iterator that does
>> two different things (ie, what you want OR destroy itself, other
>> iterators and the list) depending on the specific data structure
>> you obtained it from. [snip]
>
> Not "Bad Polymorphism". It may be (or may not be, depending on
> specifics) bad interface design, or bad implementation choice, or
> something else along those lines. The phrase "Bad Polymorphism"
> just doesn't scan in this context.

"Bad polymorphism" to me just implies "violates the LSP".
His example is one of a violation of the LSP.

Phil
--
I find the easiest thing to do is to k/f myself and just troll away
-- David Melville on r.a.s.f1

==============================================================================
TOPIC: Has thought been given given to a cleaned up C? Possibly called C+.
http://groups.google.com/group/comp.lang.c/t/5954dc70a43f9f8e?hl=en
==============================================================================

== 1 of 2 ==
Date: Fri, Mar 26 2010 1:12 am
From: Phil Carmody


lawrence.jones@siemens.com writes:
> Tim Rentsch <txr@x-alumni2.alumni.caltech.edu> wrote:
>>
>> case 0x10: goto 0x30;
>> case 0x20: /* stuff */ break;
>> case 0x30: /* stuff */ break;
>
> If we're going to enhance the syntax of goto, I think it would make more
> sense to use ``goto case 0x30'' rather than a bare integer constant
> expression.

That was the first thing that went through my mind - the 'label' is
'case 0x30'. However, the analogy with labels as being something
to be used verbatim breaks down if you want to permit constructs like

int a, b; /* ... */
switch(a) {
case 0x10: goto case b;
case 0x20: /* x20 stuff */ break;
case 0x30: /* x30 stuff */ break;
}

It's entirely possible you want to avoid contructs like that, though.

Phil
--
I find the easiest thing to do is to k/f myself and just troll away
-- David Melville on r.a.s.f1


== 2 of 2 ==
Date: Fri, Mar 26 2010 1:55 am
From: Willem


Phil Carmody wrote:
) That was the first thing that went through my mind - the 'label' is
) 'case 0x30'. However, the analogy with labels as being something
) to be used verbatim breaks down if you want to permit constructs like
)
) int a, b; /* ... */
) switch(a) {
) case 0x10: goto case b;
) case 0x20: /* x20 stuff */ break;
) case 0x30: /* x30 stuff */ break;
) }

I think that would be better expressed as something like:
int a, b; /* ... */
switch(a) {
case 0x10: reswitch(b);
case 0x20: /* x20 stuff */ break;
case 0x30: /* x30 stuff */ break;
}

Where 'reswitch(...)' basically means 'do the switch again with ...'.

I think you could even just make it:

int a, b; /* ... */
switch(a) {
case 0x10: switch(b);
case 0x20: /* x20 stuff */ break;
case 0x30: /* x30 stuff */ break;
}

Which basically just means that if a 'switch' is not followed by a block,
then the case labels are taken from the parent switch-block.


) It's entirely possible you want to avoid contructs like that, though.

If all you want is to improve fallthrough techniques, yes.


SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT

==============================================================================
TOPIC: How should I test for a null pointer?
http://groups.google.com/group/comp.lang.c/t/ac6fdf22358cde1a?hl=en
==============================================================================

== 1 of 2 ==
Date: Fri, Mar 26 2010 1:34 am
From: Nick Keighley


On 25 Mar, 16:32, BruceS <bruce...@hotmail.com> wrote:

> I recall a system (VMS?) where the standard was to use even/odd to
> indicate success/failure.

it was VMS. I think an even value was an error so a program that
returned 0 caused a bizzre error to be reported by the shell. This was
a problem for some VMS C compilers.


> We had a macro to weed out the success
> codes, and universally ignored them.  The errors codes, however, got
> used.

== 2 of 2 ==
Date: Fri, Mar 26 2010 2:53 am
From: Dr Malcolm McLean


On 25 Mar, 17:46, Kenneth Brody <kenbr...@spamcop.net> wrote:
> On 3/23/2010 1:40 PM, Eric Sosman wrote:
>
> > It's said that the best response to a bug report is
> > "Thank you."
>
> Assuming, of course, that it's really a bug.  As opposed to, say, a report
> that says something to the effect of "IsLeap(2000) returns true".
>
Or sometimes the bug report is real, but attended with a lot of abuse.
This can be dangerous, because people who don't have much experience
in programming often don't realise that even the best programmers
continually make "idiotic" errors, like off by one errors in
calculating a loop or failing to check for a divide by zero.

==============================================================================
TOPIC: ◆⊙◆ 2010 Prada handbags get low price wholesale (http://www.rijing-
trade.com) <paypal payment>
http://groups.google.com/group/comp.lang.c/t/188bc1107e38337e?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 26 2010 1:53 am
From: "www.fjrjtrade.com"

Cheap wholesale handbags

Cheap wholesale purse

Cheap wholesale Prada handbag

cheap wholesale Prada purse

Cheap wholesale AAA True Leather handbag and purse

Cheap wholesale AAA True Leather Prada handbag


http://www.rijing-trade.com

==============================================================================
TOPIC: Container library (continued)
http://groups.google.com/group/comp.lang.c/t/3763649cc890efcc?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 26 2010 2:06 am
From: Nick Keighley


On 25 Mar, 16:19, lawrence.jo...@siemens.com wrote:
> Nick Keighley <nick_keighley_nos...@hotmail.com> wrote:
> > On 20 Mar, 02:48, "ng2010" <ng2...@att.invalid> wrote:
>
> > > This sounds sooo much like thrashing on whether a "Line" should draw
> > > itself or should be drawn by a "Canvas" or other abstraction. Don't walk,
> > > run to the next level: jettison old paradigms.
>
> > so what's the answer?
>
> 42

:-)

I suspect ng is one of those people who can issue vague platitudes by
the dumper-truck load but is rather short of substance. He likes the
pithy, gnomic phrase and the sneaky put-down but there isn't really
anything behind the facade.

I could always be wrong of course.


==============================================================================
TOPIC: Cheap Wholesale 10DEEP Coat Christan Audigier Coat Armani Scarf Paul
Smith Scarf FREE SHIPPING<www.vipchinatrade.com>
http://groups.google.com/group/comp.lang.c/t/7339a83e7613288b?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Mar 26 2010 2:25 am
From: tradenow


Coat
Cheap Wholesale 10DEEP Coat (wholesale free shipping)
Cheap Wholesale 999 Coat
Cheap Wholesale A Coat (wholesale free shipping)
Cheap Wholesale Adidas Coat
Cheap Wholesale Bape Coat <www.vipchinatrade.com paypal payment>
Cheap Wholesale BBC Coat
Cheap Wholesale Christan Audigier Coat
Cheap Wholesale Coogi Coat
Cheap Wholesale ED Hardy Coat (wholesale free shipping)
Cheap Wholesale Evisu Coat
Cheap Wholesale Gndigo Coat <www.vipchinatrade.com paypal payment>
Cheap Wholesale Gucci Coat
Cheap Wholesale KA Coat (wholesale free shipping)
Cheap Wholesale Lacoste Coat <www.vipchinatrade.com paypal payment>
Cheap Wholesale LRG Coat
Cheap Wholesale Parish Coat <www.vipchinatrade.com paypal payment>
Cheap Wholesale Pjmark Coat
Cheap Wholesale POLO Coat
Cheap Wholesale Rogawpar Coat
Cheap Wholesale Sean And Joh Coat <www.vipchinatrade.com paypal
payment>

Scarf
Armani Scarf (wholesale free shipping)
Burberry Scarf<www.vipchinatrade.com paypal payment>
Chanel Scarf <www.vipchinatrade.com paypal payment>
CK Scarf (wholesale free shipping)
D&G Scarf<www.vipchinatrade.com paypal payment>
Dior Scarf <www.vipchinatrade.com paypal payment>
Fendi Scarf <www.vipchinatrade.com paypal payment>
Gucci Scarf<www.vipchinatrade.com paypal payment>
LV Scarf <www.vipchinatrade.com paypal payment>
Paul Smith Scarf<www.vipchinatrade.com paypal payment>
Tous Scarf<www.vipchinatrade.com paypal payment>

==============================================================================
TOPIC: Behavior of if construct in switch case defualt construct.
http://groups.google.com/group/comp.lang.c/t/83b500624be615ca?hl=en
==============================================================================

== 1 of 4 ==
Date: Fri, Mar 26 2010 3:54 am
From: Mukesh


Hello,

Please help in how the following program works(i.e behavior of if
statement inside switch default statement.) :

/**
* test.c - Test for switch construct.
*/
#include <stdio.h>

int main()
{
int i = 10 ;
printf("\n hello world\n");

switch (i) {
printf("\n In switch statement\n");
case 1:
printf("\n You entered: %d \n", i);
break;
case 2:

printf("\n You entered: %d \n", i);
break;

default :
if (9 == i) {
case 9:
printf("\n in case 9 entered value: %d\n", i);
break;
case 10:
printf("\n in case 10, entered value: %d\n", i);
break;
}
}

return 0;
}

Output:
++++++++
hello world

in case 10, entered value: 10


== 2 of 4 ==
Date: Fri, Mar 26 2010 4:04 am
From: "paul"


> Please help in how the following program works(i.e behavior of if
> statement inside switch default statement.) :

Not a nice program! Just a guess, but I think it jumps straight
to case 10: and ignores the if statement within the default case
since there is an matching case (10).

Also it's likely that the compiler optimises out all of the other
cases since it knows that 'i' is always 10.

/**
* test.c - Test for switch construct.
*/
#include <stdio.h>

int main()
{
int i = 10 ;
printf("\n hello world\n");

switch (i)
{
printf("\n In switch statement\n");

case 1:
printf("\n You entered: %d \n", i);
break;

case 2:
printf("\n You entered: %d \n", i);
break;

default :
if (9 == i) {

case 9:
printf("\n in case 9 entered value: %d\n", i);
break;

case 10:
printf("\n in case 10, entered value: %d\n", i);
break;

}
}

return 0;
}


== 3 of 4 ==
Date: Fri, Mar 26 2010 4:11 am
From: "bartc"


Mukesh wrote:

> Please help in how the following program works(i.e behavior of if
> statement inside switch default statement.) :

> /**
> * test.c - Test for switch construct.
> */
> #include <stdio.h>
>
> int main()
> {
> int i = 10 ;
> printf("\n hello world\n");
>
> switch (i) {
> printf("\n In switch statement\n");
> case 1:
> printf("\n You entered: %d \n", i);
> break;
> case 2:
>
> printf("\n You entered: %d \n", i);
> break;
>
> default :
> if (9 == i) {
> case 9:
> printf("\n in case 9 entered value: %d\n", i);
> break;
> case 10:
> printf("\n in case 10, entered value: %d\n", i);
> break;
> }
> }
>
> return 0;
> }

You're jumping into the body of the if-statement, so bypassing the
condition.

C's switch statement is even weirder than I thought: making nonsense of the
default case, and being able to write unreachable code like this.

> Output:
> ++++++++
> hello world
>


More interesting is how you managed to produce those "+" symbols in the
output.

--
Bartc

== 4 of 4 ==
Date: Fri, Mar 26 2010 4:17 am
From: "paul"


>> Output:
>> ++++++++
>> hello world
>>
>
>
> More interesting is how you managed to produce those "+" symbols in the
> output.

Does the code invoke undefined behaviour?

==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.c"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.c?hl=en

To unsubscribe from this group, send email to comp.lang.c+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.c/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate