comp.lang.c - 26 new messages in 11 topics - digest
comp.lang.c
http://groups.google.com/group/comp.lang.c?hl=en
Today's topics:
* Has thought been given given to a cleaned up C? Possibly called C+. - 8
messages, 8 authors
http://groups.google.com/group/comp.lang.c/t/5954dc70a43f9f8e?hl=en
* ◆⊙◆ 2010 Cheap wholesale ED Hardy Long Sleeve, AF Long Sleeve, LV Long
Sleeve ect at http://www.rijing-trade.com <Paypal Payment> - 1 messages, 1
author
http://groups.google.com/group/comp.lang.c/t/f08f74b9db0235df?hl=en
* Bollywood Latest Pictures movies - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/0f61693b98369c61?hl=en
* Casting jmp_buf to void * - 5 messages, 3 authors
http://groups.google.com/group/comp.lang.c/t/a9e559468513ce12?hl=en
* Tiffany Accessories Juicy Bracelet Dior Earrings Chanel Necklace for sale <
wholesale free shipping><www.vipchinatrade.com> - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/1c006924aa31d50f?hl=en
* Depth of Binary Tree - 4 messages, 4 authors
http://groups.google.com/group/comp.lang.c/t/8246aca121941e23?hl=en
* Beginner's guide to MinGW? - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c/t/e2cff1c3cf36ab5f?hl=en
* parsing practice - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/69eefd7d02a113a3?hl=en
* Stylistic questions on UNIX C coding. - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/51d2b24a60d73f18?hl=en
* What is the explanation? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/43491a16c11fd4e0?hl=en
* Discount Wholesale Gucci Handbag Coach Handbag LV Handbag Purse Chanel (www.
vipchinatrade.com) - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/511ed00e15ab70cb?hl=en
==============================================================================
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 8 ==
Date: Fri, Mar 12 2010 12:19 am
From: Nick Keighley
On 11 Mar, 21:45, jacob navia <ja...@jacob.remcomp.fr> wrote:
> Ian Collins a écrit :
> > On 03/11/10 10:27 PM, Richard wrote:
> >> Nick Keighley<nick_keighley_nos...@hotmail.com> writes:
> >>> On 10 Mar, 18:13, Nick<3-nos...@temporary-address.org.uk> wrote:
> >>>> [...] the problem I see with operator overloading is
> >>>> that you are stuck with an arbitrary set of operators to work with. If
> >>>> you really are just implementing, say, complex numbers or very large
> >>>> integers, then it's useful - but you don't do that very often. This is
> >>>> Jacob's position AIUI. But if you want to do something else you end up
> >>>> forcing it into this mould. This is what tends to happen.
>
> >>> my experience with C++ is the you hardly ever overload the obvious
[operators, like + and - (I said + and * the first time round but of
course * does things other than multiply!)]
> >> They are overwritten all [the] time and it makes debugging and following
> >> foreign C++ code a nightmare until you are very very very familiar with
> >> the code. And even then in base functions you can have zero idea about
> >> which will be invoked.
>
> > My experience backs Nick's observation. The only time I've (or worked
> > with other people's code) overloaded arithmetic operators is for
> > extended numeric types. I do make frequent use of [] and ().
>
> This is my point of view. Applications of operator overloading should
> be numeric data and access to containers.
>
> All other applications should be submitted to a detailed scrutiny:
>
> o Does the operator overloading make the code easier to read?
> o Is the operator overloading solution efficient? (Creation of temporary
> objects, etc)
> o Are the applications of the operator intuitive?
> o Do they mimic correctly the behavior with other types?
and assignment and equality seem to fulfill these requirements.
if (current_shape == saved_shape)
matched_shape_case (current_shape);
control_channel = selected_channel;
what about smart pointers and function objects?
I seem to be repeating myself...
== 2 of 8 ==
Date: Fri, Mar 12 2010 2:20 am
From: jacob navia
Nick a écrit :
> jacob navia <jacob@jacob.remcomp.fr> writes:
>
>> This is my point of view. Applications of operator overloading should
>> be numeric data and access to containers.
>>
>> All other applications should be submitted to a detailed scrutiny:
>>
>> o Does the operator overloading make the code easier to read?
>> o Is the operator overloading solution efficient? (Creation of temporary
>> objects, etc)
>> o Are the applications of the operator intuitive?
>> o Do they mimic correctly the behavior with other types?
>
> Which greatly reduces the value of it as a feature of the language. I
> can't imagine I'm ever going to want to implement a new sort of number
> in C and need it so well integrated that calling a few functions on some
> special variables is too much trouble.
Then ick, do not use operator overloading, and just use the libraries that
come with it. Counted string libraries, bignums libraries, container libraries,
etc. Nobody forces you to use that if you do not need it.
It's a benefit to the
> implementor, and to the writers of a few libraries, but not much else
> I'd have thought.
What else you "had thought"... ?
The silver bullet? No it isn't.
== 3 of 8 ==
Date: Fri, Mar 12 2010 2:46 am
From: jacob navia
Ben Bacarisse a écrit :
>
> Not all such sets of matrices from a ring. I'm sure you know that.
>
>> The fact that you can generalise
>> the operation (with restrictions) to arbitrary dimensions in no way
>> reduces the fact that it is clearly (to a mathematician) a cognate to
>> multiplication.
>
> Agreed. But conversely, the fact that you can restrict the operation
> does not diminish the fact that, to some, the analogy with
> multiplication is strained.
>
> Discussions here would be so much more productive if people took the
> time to acknowledge some validity (if there is some) in other people's
> point of view. Pretty much the only reason I posted was that your
> reply was so totally dismissive of Alan's view. I am with you in that
> I see why mathematicians call it multiplication, but I can also see
> the craziness -- the operation is not even defined for some pairs of
> matrices. Your reply essentially said "it is called multiplication
> because it is multiplication".
>
> <snip>
To come back to the operator overloading discussion.
The big problem with operator overloading and matrices multiplication
is the intermediate objects problem.
If we overload in a "standard" way matrix multiplication, addition etc
we can write:
C = (A+B)/(B*D);
The overloaded "*" operator creates a temporary (t1) so we have
C = (A+B)/t1;
The overloaded "+" operator creates a t2 temporary so that
C = t2/t1;
If the matrices are big, we have 2 times the storage...
There are solutions to this problem, but they are tricky. One of them
is that all operators return a tokenized structure, that instructs
the overloaded assignment operators what operations should be done.
This should be done at runtime, what makes this solution the equivalent
of having a run time interpreter of this precompiled instructions...
not very easy.
== 4 of 8 ==
Date: Fri, Mar 12 2010 3:17 am
From: Ian Collins
On 03/12/10 09:19 PM, Nick Keighley wrote:
>
> what about smart pointers and function objects?
These wouldn't be anywhere near as useful in C as they are in C++
because C lacks automatic constructors and destructors.
--
Ian Collins
== 5 of 8 ==
Date: Fri, Mar 12 2010 3:25 am
From: "bartc"
"jacob navia" <jacob@jacob.remcomp.fr> wrote in message
news:4b9a1b86$0$17898$ba4acef3@reader.news.orange.fr...
> To come back to the operator overloading discussion.
>
> The big problem with operator overloading and matrices multiplication
> is the intermediate objects problem.
>
> If we overload in a "standard" way matrix multiplication, addition etc
> we can write:
>
> C = (A+B)/(B*D);
>
> The overloaded "*" operator creates a temporary (t1) so we have
> C = (A+B)/t1;
>
> The overloaded "+" operator creates a t2 temporary so that
> C = t2/t1;
>
> If the matrices are big, we have 2 times the storage...
Would the problems be any different when writing:
C = DIV(ADD(A,B),MUL(B,D)); ?
If not, then they would not be specific to operator overloading.
--
Bartc
== 6 of 8 ==
Date: Fri, Mar 12 2010 7:51 am
From: Jasen Betts
On 2010-03-12, Andrew Poelstra <apoelstra@localhost.localdomain> wrote:
> On 2010-03-11, Dag-Erling Smørgrav <des@des.no> wrote:
>> Andrew Poelstra <apoelstra@localhost.localdomain> writes:
>>> IRRC C99 required changes to linkers,
>>
>> Details? Apart from increasing the length of the significant portion of
>> identifiers, that is.
>>
>
> That was it. It also added case-sensitivity, I think. To allow
> namespaces, they could be changed as little as simply allowing
> a new namespace-separator character to be used in tokens.
C has been case sensitive for as long as I can remember. I would be
suprised if the compiler invented for unix was ever case insensitive.
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
--
comp.lang.c.moderated - moderation address: clcm@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
== 7 of 8 ==
Date: Fri, Mar 12 2010 7:52 am
From: James Kuyper
Andrew Poelstra wrote:
> On 2010-03-11, Dag-Erling Smørgrav <des@des.no> wrote:
>> Andrew Poelstra <apoelstra@localhost.localdomain> writes:
>>> IRRC C99 required changes to linkers,
>> Details? Apart from increasing the length of the significant portion of
>> identifiers, that is.
>>
>
> That was it. It also added case-sensitivity, I think. To allow
> namespaces, they could be changed as little as simply allowing
> a new namespace-separator character to be used in tokens.
I would expect that changing the number of significant characters in an
identifier is a substantially easier task than expanding the list of
allowed characters. After all, why bother prohibiting a character
without a good reason? A character that's prohibited is generally
prohibited precisely because it is already in use for some conflicting
purpose, in which case it might be a major headache to work around the
conflict.
--
comp.lang.c.moderated - moderation address: clcm@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
== 8 of 8 ==
Date: Fri, Mar 12 2010 7:53 am
From: Dag-Erling Smørgrav
jacob navia <jacob@nospam.org> writes:
> Dag-Erling Smørgrav a écrit :
> > jacob navia <jacob@jacob.remcomp.fr> writes:
> > > o AVL trees
> > > o Red/Black trees
> > What is the advantage of having both? AFAIK they have the same
> > semantics and the same computational complexity.
> Exactly, they are different IMPLEMENTATIONS of a given interface.
> The objective here is to let the user choose which trees or data
> structure fits best in his/her requirements.
My point is that the only difference between RB and AVL trees, AFAIK, is
that RB trees are easier to implement, which is why most container
libraries use them. There is no practical difference for the user. The
semantics and complexity are exactly the same.
DES
--
Dag-Erling Smørgrav - des@des.no
--
comp.lang.c.moderated - moderation address: clcm@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
==============================================================================
TOPIC: ◆⊙◆ 2010 Cheap wholesale ED Hardy Long Sleeve, AF Long Sleeve, LV Long
Sleeve ect at http://www.rijing-trade.com <Paypal Payment>
http://groups.google.com/group/comp.lang.c/t/f08f74b9db0235df?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 12:36 am
From: "www.fjrjtrade.com"
Cheap wholesale Long Sleeve
Cheap wholesale Armani Long Sleeve
Cheap wholesale G-STAR Long Sleeve
Cheap wholesale A&F Long Sleeve
Cheap wholesale Christan Audigier Long Sleeve
Cheap wholesale D&G Man Long Sleeve
Cheap wholesale Ecko Long Sleeve
Cheap wholesale ED Hardy Long Sleeve
Cheap wholesale Gucci Long Sleeve
Cheap wholesale Lacoste Long Sleeve
Cheap wholesale LV Long Sleeve
Cheap wholesale Nike Long Sleeve
Cheap wholesale Ralph Lauren POLO Long Sleeve
==============================================================================
TOPIC: Bollywood Latest Pictures movies
http://groups.google.com/group/comp.lang.c/t/0f61693b98369c61?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 12:40 am
From: kathar008 basha
Bollywood Latest Pictures movies
Latest Movies Download
Kareena Kapoor Pictures and videos Katrina Kaif Pictures Download
All In One Blog Download Free Videos
==============================================================================
TOPIC: Casting jmp_buf to void *
http://groups.google.com/group/comp.lang.c/t/a9e559468513ce12?hl=en
==============================================================================
== 1 of 5 ==
Date: Fri, Mar 12 2010 1:13 am
From: Michael Foukarakis
On Mar 11, 7:10 pm, Noob <r...@127.0.0.1> wrote:
> Hello everyone,
>
> I'm using a library which provides a void *user_data field
> inside the struct used everywhere within the library.
>
> I need to stuff a jmp_buf inside user_data.
>
> I suppose I can't write
>
> jmp_buf env;
> ctx->user_data = env;
>
> and then use ctx->user_data as setjmp's and longjmp's parameter?
As long as you make sure the pointer won't dangle, you can do this.
== 2 of 5 ==
Date: Fri, Mar 12 2010 4:33 am
From: Noob
Eric Sosman wrote:
> Noob wrote:
>
>> I'm using a library which provides a void *user_data field
>> inside the struct used everywhere within the library.
>>
>> I need to stuff a jmp_buf inside user_data.
>>
>> I suppose I can't write
>>
>> jmp_buf env;
>> ctx->user_data = env;
>>
>> and then use ctx->user_data as setjmp's and longjmp's parameter?
>
> Yes, you can. For historical reasons jmp_buf is an array type,
I was not aware of that. Thank you for pointing it out to me.
<quote C89 draft>
The type declared is
jmp_buf
which is an array type suitable for holding the information needed to
restore a calling environment.
</quote>
> and you know The Rule about arrays: In all but a few
> contexts, mentioning the name of an array is the same as writing
> a pointer to the array's first element. So
>
> ctx->user_data = env;
>
> is the same as
>
> ctx->user_data = &env[0];
On a moderately related note, I've been wondering...
Given int foo[42];
&foo[0] and &foo will not be compatible pointers, right?
Yet, would the two pointers have the same value?
i.e. (uintptr_t)&foo[0] ==(uintptr_t)&foo ???
>> Instead, I'd have to write
>>
>> jmp_buf env;
>> ctx->user_data = &env;
>
> This would also work, but there's no pressing need to
> write it this way.
Cool.
> Since the only (useful) thing you can do with a pointer
> to the first element of a jmp_buf is call longjmp() with it,
> and since longjmp() is an ordinary function call, a void*
> argument will automatically convert to the proper type as
> part of the call.
>
> The situation with setjmp() is less clear. Since setjmp()
> is a macro rather than a function (although its expansion may
> call one or more functions), it might do things with its jmp_buf
> argument that an ordinary function could not do via a pointer.
> As far as I can tell, calling setjmp() with a pointer to the
> start of a jmp_buf is *not* guaranteed to work.
>
>> Did I get it right?
>
> Sort of, I guess.
>
>> Is there different way to do this?
>
> It's not clear what you mean by "this." You can certainly
> call setjmp() on a jmp_buf object, pass around a void* pointer
> to that object, and eventually call longjmp() on the pointer.
What you describe is precisely what I did, based on your advice.
static void myexit(j_common_ptr cinfo)
{
longjmp(cinfo->client_data, 666);
}
static int decode_image(char *file, int *w, int *h)
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
jmp_buf jmpbuf;
int err = 0;
cinfo.err = jpeg_std_error(&jerr);
cinfo.client_data = jmpbuf;
jerr.error_exit = myexit;
if (setjmp(jmpbuf) != 0)
{
err = FAIL;
goto unwind;
}
jpeg_create_decompress(&cinfo);
...
unwind:
jpeg_destroy_decompress(&cinfo);
vfs_fclose(infile);
return err;
}
(jerr.error_exit is called from within the library whenever a fatal
condition occurs, and the current operation cannot proceed.)
Regards.
== 3 of 5 ==
Date: Fri, Mar 12 2010 4:36 am
From: Noob
Ben Bacarisse wrote: [snip]
Thanks to you, and to Eric, for your detailed and insightful answers.
== 4 of 5 ==
Date: Fri, Mar 12 2010 5:57 am
From: Eric Sosman
On 3/11/2010 8:03 PM, pete wrote:
> Peter Nilsson wrote:
>
>> Is pow(2, 0.5) undefined since pow may be implemented as a
>> macro and 2 is not of type double?
>
> I don't think so.
> To me, implementing a function as a macro,
> means that the macro must do what the function is supposed to do.
The problem here is the opposite one: setjmp() *is* a
macro, not a function that may also be masked by a macro.
On some platforms the setjmp() macro may simply expand to
a call on a setjmp() function, and the Standard reserves
that name for external linkage, but that's not required.
The possibility remains open that the setjmp() macro might
expand to some code that works only with an actual jmp_buf
array and not with a pointer thereto. Something like
#define setjmp(buf) ( \
(buf)[0]._secret_ = sizeof(buf) , \
(buf)[0]._arcane_ = &(buf) , \
setjmp(buf) \
)
would behave differently with a pointer than with an actual
jmp_buf.
The Rationale discusses some of the reasons why "setjmp()
should be usable as an ordinary function" is deliberately
not required by the Standard.
--
Eric Sosman
esosman@ieee-dot-org.invalid
== 5 of 5 ==
Date: Fri, Mar 12 2010 6:07 am
From: Eric Sosman
On 3/12/2010 7:33 AM, Noob wrote:
>[...]
> On a moderately related note, I've been wondering...
>
> Given int foo[42];
>
> &foo[0] and &foo will not be compatible pointers, right?
See Question 6.12 in the FAQ (http://www.c-faq.com/).
--
Eric Sosman
esosman@ieee-dot-org.invalid
==============================================================================
TOPIC: Tiffany Accessories Juicy Bracelet Dior Earrings Chanel Necklace for
sale <wholesale free shipping><www.vipchinatrade.com>
http://groups.google.com/group/comp.lang.c/t/1c006924aa31d50f?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 1:31 am
From: yoyotrade
Chanel Accessories:
Chanel Bracelet
Chanel Chain Bracelet
Chanel Earrings
Chanel Necklace www.vipchinatrade.com paypal payment
Coach Accessories:
Coach Chain Bracelet
Coach Earrings
Coach Necklace www.vipchinatrade.com paypal payment
(wholesale free shipping )
TOUS Accessories:
TOUS Chain Bracelet www.vipchinatrade.com
(wholesale free shipping )
D&G Accessories:
D&G Chain Bracelet
D&G Earrings
D&G Necklace www.vipchinatrade.com paypal payment
(wholesale free shipping )
Dior Accessories:
Dior Chain Bracelet
Dior Earrings www.vipchinatrade.com paypal payment
Dior Necklace
(wholesale free shipping )
Gucci Accessories:
Gucci Bracelet
Gucci Chain Bracelet
Gucci Earrings
Gucci Necklace www.vipchinatrade.com paypal payment
Gucci Rings www.vipchinatrade.com
(wholesale free shipping )
Juicy Accessories:
Juicy Chain Bracelet
Juicy Earrings www.vipchinatrade.com paypal payment
Juicy Necklace
www.vipchinatrade.com (wholesale free shipping )
Links Accessories:
Links Chain Bracelet www.vipchinatrade.com paypal payment
Links Necklace
Links Pendants
Links Rings
www.vipchinatrade.com (wholesale free shipping )
LV Accessories:
LV Chain Bracelet
LV Necklace
www.vipchinatrade.com (wholesale free shipping )
Pandora Chain Bracelet:
(wholesale free shipping )
Swarovski Chain Bracelet: www.vipchinatrade.com
(wholesale free shipping )
Tiffany Accessories:
Tiffany Bracelet
Tiffany Chain Bracelet
Tiffany Earrings
Tiffany Necklace
Tiffany Rings(wholesale free shipping )
www.vipchinatrade.com paypal payment
==============================================================================
TOPIC: Depth of Binary Tree
http://groups.google.com/group/comp.lang.c/t/8246aca121941e23?hl=en
==============================================================================
== 1 of 4 ==
Date: Fri, Mar 12 2010 1:33 am
From: Nick Keighley
On 11 Mar, 22:24, Eric Sosman <esos...@ieee-dot-org.invalid> wrote:
> Of course, a true mathematician would have concluded "by
> inspection" that the number of calls to explore the complete
> tree of depth n is the same as the number of non-degenerate
> right-angled incongruent integer-edged Heron triangles whose
> circumdiameter is the product of n distinct primes of shape
> 4k + 1. (Slaps forehead: Now, why didn't *I* think of that?)
I knew a programmer who dealt with mathematicians ("tame
mathematicians" he referred to them as) on a regular basis; he came to
the conclusion that any mathematical question asked of them always
gave one of these standard answers:-
1. I don't understand why you cannot see that this follows trivially
from the axioms.
2. this is a hard problem to which we currently don't have a solution
== 2 of 4 ==
Date: Fri, Mar 12 2010 2:41 am
From: Giovanni Senatore
On 03/11/2010 06:14 PM, RAKHE wrote:
> I have come accross with the code for finding Depth of tree, i am
> not
> getting this, please anyone throw a light on this ....
>
> http://www.math.bas.bg/~nkirov/2010/NETB201/slides/ch06/pic3.jpg
>
>
> please explain in code level rather than theoratical level.
>
>
> int depth(treenode *p)
> {
> if(p==NULL)return(0);
> if(p->left){h1=depth(p->left);}
> if(p=>right){h2=depth(p->right);}
> return(max(h1,h2)+1);
>
>
> }
i think that something like this can be functional...
#define MAX(A,B) (A>B)?A:B
typedef struct node {
void* value; /* pointer to some value */
struct node* l; /* left side pointer */
struct node* r; /* right side pointer */
} node_t;
/*
* globally declared var just to avoid passing as
* argument....
*/
int curdepth; /* current depth counter, it could start
* from 0 or 1 as needed
*/
int maxdepth; /* max depth counter, same as curdepth */
void
tree(node_t* node)
{
curdepth++; /* update current position */
if(node->l != NULL) tree(node->l); /* follow left side if any */
if(node->r != NULL) tree(node->r); /* follow right side if any */
/*
* if and only if this is the the last node of the graph tree
* i must compute the max value between curdepth and
* the previous maxdepth.
*/
maxdepth=MAX(maxdepth,curdepth);
curdepth--; /* since i go back to the
parent i need to decrease
the current position counter
before return */
return;
}
== 3 of 4 ==
Date: Fri, Mar 12 2010 5:40 am
From: Eric Sosman
On 3/12/2010 4:33 AM, Nick Keighley wrote:
> On 11 Mar, 22:24, Eric Sosman<esos...@ieee-dot-org.invalid> wrote:
>
>> Of course, a true mathematician would have concluded "by
>> inspection" that the number of calls to explore the complete
>> tree of depth n is the same as the number of non-degenerate
>> right-angled incongruent integer-edged Heron triangles whose
>> circumdiameter is the product of n distinct primes of shape
>> 4k + 1. (Slaps forehead: Now, why didn't *I* think of that?)
>
> I knew a programmer who dealt with mathematicians ("tame
> mathematicians" he referred to them as) on a regular basis; he came to
> the conclusion that any mathematical question asked of them always
> gave one of these standard answers:-
>
> 1. I don't understand why you cannot see that this follows trivially
> from the axioms.
> 2. this is a hard problem to which we currently don't have a solution
Martin "Mathematical Games" Gardner wrote of relating a
mathematical problem to an actual mathematician:
A few years ago I had the pleasure of explaining
[Scott Kim's] polycube-snake problem to John Horton
Conway, the Cambridge mathematician. When I concluded
by saying Kim had not yet shown that two snakes could
not tile three-dimensional space, Conway instantly
said, "But it's obvious that--" He checked himself in
mid-sentence, stared into three-space for a minute or
two, then exclaimed, "It's *not* obvious!"
--
Eric Sosman
esosman@ieee-dot-org.invalid
== 4 of 4 ==
Date: Fri, Mar 12 2010 6:08 am
From: Andrew Poelstra
On 2010-03-12, Giovanni Senatore <giovanni.senatore@gmail.com> wrote:
>
> i think that something like this can be functional...
>
> #define MAX(A,B) (A>B)?A:B
>
> typedef struct node {
> void* value; /* pointer to some value */
> struct node* l; /* left side pointer */
> struct node* r; /* right side pointer */
> } node_t;
>
> /*
> * globally declared var just to avoid passing as
> * argument....
> */
> int curdepth; /* current depth counter, it could start
> * from 0 or 1 as needed
> */
> int maxdepth; /* max depth counter, same as curdepth */
>
> void
> tree(node_t* node)
> {
> curdepth++; /* update current position */
> if(node->l != NULL) tree(node->l); /* follow left side if any */
> if(node->r != NULL) tree(node->r); /* follow right side if any */
> /*
> * if and only if this is the the last node of the graph tree
> * i must compute the max value between curdepth and
> * the previous maxdepth.
> */
> maxdepth=MAX(maxdepth,curdepth);
> curdepth--; /* since i go back to the
> parent i need to decrease
> the current position counter
> before return */
> return;
> }
/Don't/ do that. This solution obviously cannot work for
more than one call, and after an absurd amount of effort
analysing it, I'm pretty sure it won't even work once.
At least, it can't return anything since it returns void
and its side effect *shudder* is cancelled at the end of
each call.
The original function was correct - and could be seen to
be so at first glance.
--
Andrew Poelstra
http://www.wpsoftware.net/andrew
==============================================================================
TOPIC: Beginner's guide to MinGW?
http://groups.google.com/group/comp.lang.c/t/e2cff1c3cf36ab5f?hl=en
==============================================================================
== 1 of 2 ==
Date: Fri, Mar 12 2010 1:43 am
From: Nick Keighley
On 11 Mar, 12:19, Branimir Maksimovic <bm...@hotmail.com> wrote:
> On Thu, 11 Mar 2010 13:09:16 +0100
> Richard <rgrd...@gmail.com> wrote:
> > Branimir Maksimovic <bm...@hotmail.com> writes:
> > > On Thu, 11 Mar 2010 03:40:45 -0800 (PST)
> > > Nick Keighley <nick_keighley_nos...@hotmail.com> wrote:
> > >> On 11 Mar, 10:58, gaze...@shell.xmission.com (Kenny McCormack)
> > >> > <8570349a-efc2-432a-b7e4-61e88c299...@q16g2000yqq.googlegroups.com>,
> > >> > Nick Keighley <nick_keighley_nos...@hotmail.com> wrote:
<snip>
> > >> > >Microsoft's "Visual C++ Express" is another free compiler. And
> > >> > >despite the weird name it compiles bog-standard C. [...]
Note Well: it compiles C. In other words the package includes a C
compiler as well as a C++ compiler.
<snip>
> > >> [...] Microsoft are completly up to date with the most
> > >> portable version of the C standard (1989/1990). [...]
>
> > > Is C++ completely compatible with C 89/90? Basic idea of C++ is
> > > to be compatible with C, while you can use syntactic sugar in
> > > order to write less code.
>
> > LOL. What a load of nonsense. That is not the "Basic idea of C++" at
> > all. Where on earth did you learn that?
>
> Well, first target audience for C++ were C programmers.
> So basically C with classes was original idea.
C++ is a lot more than "C with classes". I don't think Bjarne
Stroustrup ever had the motives you attribute to him. He wasn't trying
to superset C.
> > > Problem is now if they are not compatible and let's say if you write
> > > C/C++ you can;t write C99/C++ ;)
>
> > > Technically one would expect same behavior, but if one is used to
> > > C++ now it is difficult to move to C99 or vice versa.
>
> > No it isn't. They are different languages with a similar subset.
AOL: I quite agree
> Oh, unfortunately they are different languages, not fortunately.
It's neither fortunate nor unfortunate; merely true.
> Have you ever thought why is C99 not so successful and widely
> adopted? VC++ note "++" in it's name ;)
despite the name VC++ includes a C compiler (though not a C99
compiler)
If I were naming it it would be called "Microsoft C and C++ Compiler
Package" but Microsoft marketing never contacted me about a job.
--
Sesame Street today is brought to you by the number e
and the colour 1850K!
== 2 of 2 ==
Date: Fri, Mar 12 2010 2:16 am
From: gazelle@shell.xmission.com (Kenny McCormack)
In article <0f794e5d-eba0-4b9a-aef4-1a45ecbc134a@33g2000yqj.googlegroups.com>,
Nick Keighley <nick_keighley_nospam@hotmail.com> wrote:
>On 11 Mar, 12:19, Branimir Maksimovic <bm...@hotmail.com> wrote:
>> On Thu, 11 Mar 2010 13:09:16 +0100
>> Richard <rgrd...@gmail.com> wrote:
>> > Branimir Maksimovic <bm...@hotmail.com> writes:
>> > > On Thu, 11 Mar 2010 03:40:45 -0800 (PST)
>> > > Nick Keighley <nick_keighley_nos...@hotmail.com> wrote:
>> > >> On 11 Mar, 10:58, gaze...@shell.xmission.com (Kenny McCormack)
>> > >> > <8570349a-efc2-432a-b7e4-61e88c299...@q16g2000yqq.googlegroups.com>,
>> > >> > Nick Keighley <nick_keighley_nos...@hotmail.com> wrote:
>
><snip>
>
>> > >> > >Microsoft's "Visual C++ Express" is another free compiler. And
>> > >> > >despite the weird name it compiles bog-standard C. [...]
>
>Note Well: it compiles C. In other words the package includes a C
An old, non-current version of 'C'.
==============================================================================
TOPIC: parsing practice
http://groups.google.com/group/comp.lang.c/t/69eefd7d02a113a3?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 2:18 am
From: gazelle@shell.xmission.com (Kenny McCormack)
In article <871vfq7z5n.fsf@temporary-address.org.uk>,
Nick <3-nospam@temporary-address.org.uk> wrote:
>Andrew Poelstra <apoelstra@localhost.localdomain> writes:
>
>> On 2010-03-11, Nick <3-nospam@temporary-address.org.uk> wrote:
>>> "Bill Cunningham" <nospam@nspam.invalid> writes:
>>>
>>>>
>>>> It takes input from the keyboard. I thought that was stdin.
>>>
>>> No, it takes input from the command line.
>>>
>>> I can create a shell that launches it with a suitable input string and
>>> make it that this is run whenever I log onto the computer. No keyboard
>>> input in sight.
>>
>> To be fair, you can do this with stdin as well.
>
>True. Nevertheless, using command line arguments is /not/ "taking from
>stdin".
It could be/could have been. What do you suppose the shell reads from
when you are typing a command?
==============================================================================
TOPIC: Stylistic questions on UNIX C coding.
http://groups.google.com/group/comp.lang.c/t/51d2b24a60d73f18?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 6:09 am
From: raltbos@xs4all.nl (Richard Bos)
BruceS <bruces42@hotmail.com> wrote:
> On Mar 10, 7:14=A0am, ralt...@xs4all.nl (Richard Bos) wrote:
> > BruceS <bruce...@hotmail.com> wrote:
> > > That's a good one; I'll try to remember it.
> > > FWIW, the K&R bit was intentional, to make the joke more obvious. =A0Not
> > > obvious enough for some, but apparently I either overestimated the
> > > volume in the ng, or underestimated the mass. =A0My bad.
> >
> > No, as should by now be clear, you underestimated the number of people
> > who have made such arguments in this newsgroup in all seriousness. I
> > didn't understand it was a joke, not because it wasn't jokey enough, but
> > because too many people before you have said similar things with no
> > jocular intent at all.
>
> OK, I'm glad we're clear now. It's either sad or laughable (maybe
> both) that people do take this so seriously.
Definitely both. Hence my misdirected attempt at sarcasm.
> So no matter how silly I try to be, someone else acts the same way
> being serious.
Depends on the subject; this is certainly one for which that is almost
true. Almost; even I would smell a rat if someone posted
if
{
/* code... */
}
Richard
==============================================================================
TOPIC: What is the explanation?
http://groups.google.com/group/comp.lang.c/t/43491a16c11fd4e0?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 7:46 am
From: Dave Hansen
On Mar 11, 5:53 pm, Phil Carmody <thefatphil_demun...@yahoo.co.uk>
wrote:
> Perl's older than python by quite a way. Is there any chance you're
> thinking of that?
For sufficiently small values of "quite a way" (Perl: 1987, Python:
1989).
Regards,
-=Dave
==============================================================================
TOPIC: Discount Wholesale Gucci Handbag Coach Handbag LV Handbag Purse Chanel (
www.vipchinatrade.com)
http://groups.google.com/group/comp.lang.c/t/511ed00e15ab70cb?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Mar 12 2010 7:50 am
From: yoyotrade
AAA true leather Handbags
Cheap Wholesale Balenciaga Handbags <www.vipchinatrade.com paypal
payment>
Cheap Wholesale Balenciaga Purse
Cheap Wholesale Bally Purse <free shipping paypal payment>
Cheap Wholesale BOSS Purse <www.vipchinatrade.com paypal payment>
Cheap Wholesale Burberry Handbags
Cheap Wholesale Chanel Handbags <free shipping paypal payment>
Cheap Wholesale Chanel Purse
Cheap Wholesale Chloe Handbags
Cheap Wholesale Chloe Purse <free shipping paypal payment>
Cheap Wholesale Coach Handbags
Cheap Wholesale Coach Purse <www.vipchinatrade.com.cn paypal
payment>
Cheap Wholesale D&G Handbags
Cheap Wholesale D&G Purse
Cheap Wholesale Dior Handbags <free shipping paypal payment>
Cheap Wholesale Dunhill Purse
Cheap Wholesale Fendi Handbags <free shipping paypal payment>
Cheap Wholesale Gucci Handbags <www.vipchinatrade.com.cn paypal
payment>
Cheap Wholesale Gucci Purse
Cheap Wholesale Hermes Handbags
Cheap Wholesale Hermes Purse <free shipping paypal payment>
Cheap Wholesale Jimmy Choo Handbags <free shipping paypal
payment>
Cheap Wholesale Jimmy Choo Purse <free shipping paypal payment>
Cheap Wholesale Juicy Handbags <www.vipchinatrade.com paypal
payment>
Cheap Wholesale Kooba Handbags
Cheap Wholesale Lancel Handbags
Cheap Wholesale Loewe Handbags <www.vipchinatrade.com paypal
payment>
Cheap Wholesale LV Handbags <free shipping paypal payment>
Cheap Wholesale LV Purse <free shipping paypal payment>
Cheap Wholesale Marc Jacobs Handbags <www.vipchinatrade.com paypal
payment>
Cheap Wholesale Miumiu Handbags
Cheap Wholesale Mulberry Handbags
Cheap Wholesale Prada Handbags <free shipping paypal payment>
Cheap Wholesale Prada Purse
Cheap Wholesale Thomaswlde Handbags <www.vipchinatrade.com paypal
payment>
Cheap Wholesale Valentnv Handbags
Cheap Wholesale Versace Handbags <www.vipchinatrade.com paypal
payment>
A+ Grade
Purse
Discount Wholesale Anna Purse <free shipping paypal payment>
Discount Wholesale Burbetty Purse
Discount Wholesale Chanel Purse <www.vipchinatrade.com >
Discount Wholesale Chloe Purse
Discount Wholesale Coach Purse <www.vipchinatrade.com >
Discount Wholesale D&G Purse
Discount Wholesale Dior Purse <www.vipchinatrade.com >
Discount Wholesale Dooney&Bourke Purse
Discount Wholesale ED Hardy Purse <www.vipchinatrade.com >
Discount Wholesale Fendi Purse
Discount Wholesale Ferragmo Purse
Discount Wholesale Gucci Purse <www.vipchinatrade.com >
Discount Wholesale Guess Purse
Discount Wholesale LV Purse <free shipping paypal payment>
Discount Wholesale Miumiu Purse
Discount Wholesale Prada Purse <www.vipchinatrade.com >
Discount Wholesale Tous Purse
Discount Wholesale Versace Purse <www.vipchinatrade.com > <free
shipping paypal payment>
Handbags
Discount Wholesale BOSS Handbag
Discount Wholesale Burberry Handbag <www.vipchinatrade.com >
Discount Wholesale CA Handbag
Discount Wholesale Chanel Handbag <free shipping paypal payment>
Discount Wholesale Chloe Handbag <www.vipchinatrade.com >
Discount Wholesale Coach Handbag
Discount Wholesale D&G Handbag <www.vipchinatrade.com >
Discount Wholesale Dooney&Bourke Handbag
Discount Wholesale ED Hardy Handbag <www.vipchinatrade.com >
Discount Wholesale Fendi Handbag
Discount Wholesale Gucci Handbag <www.vipchinatrade.com >
Discount Wholesale Hermes Handbag
Discount Wholesale Jimmy Choo Handbag <free shipping paypal
payment>
Discount Wholesale Juciy Handbag
Discount Wholesale LV Handbag <www.vipchinatrade.com >
Discount Wholesale Miumiu Handbag <www.vipchinatrade.com >
Discount Wholesale Prada Handbag
Discount Wholesale Tous Handbag <www.vipchinatrade.com >
Discount Wholesale Versace Handbags <free shipping paypal payment>
==============================================================================
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