Wednesday, February 3, 2010

comp.lang.c - 25 new messages in 6 topics - digest

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

comp.lang.c@googlegroups.com

Today's topics:

* Warning to newbies - 5 messages, 3 authors
http://groups.google.com/group/comp.lang.c/t/9597fd702985dff4?hl=en
* Macro to manipulate chars inside string - 8 messages, 6 authors
http://groups.google.com/group/comp.lang.c/t/9d5125687dd742c0?hl=en
* (((( ۞))))wholesale cheap belts, shoes, handbags, purse and T-shirts
etc at www.ecyaya.com - 3 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/fa8b03986ffabfb2?hl=en
* Didn't get Ben Pfaff code (chapter 12 of The Book). - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c/t/29a7d514c784cee3?hl=en
* free c text book advice.. - 6 messages, 6 authors
http://groups.google.com/group/comp.lang.c/t/adf51d19d9b07faf?hl=en
* Copying one array to another array - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/b8577e4d80b55c5d?hl=en

==============================================================================
TOPIC: Warning to newbies
http://groups.google.com/group/comp.lang.c/t/9597fd702985dff4?hl=en
==============================================================================

== 1 of 5 ==
Date: Wed, Feb 3 2010 9:35 am
From: spinoza1111


On Feb 4, 1:19 am, Colonel Harlan Sanders <Har...@kfc.com> wrote:
> On Wed, 3 Feb 2010 06:16:33 -0800 (PST),spinoza1111
>
>
>
>
>
> <spinoza1...@yahoo.com> wrote:
> >On Feb 3, 10:53 am, rich...@cogsci.ed.ac.uk (Richard Tobin) wrote:
> >> In article <35550a06-2346-4236-a197-fbd1eebc6...@e19g2000prn.googlegroups.com>,
>
> >>spinoza1111 <spinoza1...@yahoo.com> wrote:
> >> >that you're the one who needs to look at his problems, including the
> >> >deviant behavior in which you're engaging: it appears to me that you
> >> >are not even technically qualified to post here, and instead you
> >> >cruise networks (dressed in a bra, panties and Nazi hat?)
>
> >> If anyone was in any doubt about you, this should clear it up.
> >> I quote you here so that you cannot remove your disgusting
> >> statements from the public record.
>
> >What's disgusting is what happens to people who take the risk of
> >posting interesting and creative material about C and related matters,
> >only to find themselves the target of abuse.
>
> True, you certainly have targetted Seebs and Heathfield for abuse.
>
> >This character Harlan, in particular, has contributed nothing to this
> >discussion except abuse in which he takes his cue from the mob.
>
> Mob? I thought I was a transvestite loner in a basement -- when did I
> become part of a mob?

Yes, a cross-dressed loner in a basement,
In bra, panties, and a Hitler Hat,
Joining an ONLINE mob. Get it, slob?
>
> >He seeks to expose others and to ascribe to them the weakness,
> >impotence and fear he feels in a ridiculous zero-sum exchange in
> >which that gives him masturbatory relief.
>
> Was that more of your versification? I see a William S Burroughs
> influence. Random phrases tacked together that make no sense, yet
> manage to give an impression of malice.

It makes no sense, Hortense, if you cannot read
You should learn Ignorance, to plead
And if your horizons extend no further back
Than Burroughs, wack,
Then metrical verse in the style of Dryden or Pope?
Forget it, to ken it, it is beyond that for which thou may hope.


== 2 of 5 ==
Date: Wed, Feb 3 2010 9:58 am
From: "Chris M. Thomasson"


"spinoza1111" <spinoza1111@yahoo.com> wrote in message
news:c1bac7ad-3b6b-43b9-b065-5c5fcb688151@w27g2000pre.googlegroups.com...
On Feb 4, 12:38 am, "Chris M. Thomasson" <n...@spam.invalid> wrote:
> > "spinoza1111" <spinoza1...@yahoo.com> wrote in message
> >
> > news:d43e5d11-b684-4dd7-ad88-b90243c41f63@z10g2000prh.googlegroups.com...
> >
> > [...]
> >
> > > The problem being that the software in these planes (and in
> > > automobiles such as the Toyota) can't be written in a language like C
> > > which does allow the programmer to code outside of sensible boundaries
> > > for shits, giggles and "efficiency". Programmers need to be LESS
> > > skilled and consider themselves clerks, and they need, in my view, to
> > > be forced, especially in mission-critical systems, to be glorified
> > > clerks, by requiring that they code in Java or C#, not C.
> >
> > What about C++ Edward?
> >
> > http://www2.research.att.com/~bs/JSF-AV-rules.pdf
> >
> > IMO, this is definitely an area that simply cannot tolerate any type of
> > bug
> > whatsoever. I can see it know:

> I'd say military avionics is more bug-tolerant than civilian, wouldn't
> you? Don't get me started on jet fighters...and how in the absence of
> the conflict for which they were designed (an all-out conventional war
> between the USSR and USA) they are used on populations of the Third
> World that consist mostly of children owing to simple demographics.
> For example, Israel used fighters EXCLUSIVELY for attacks on civilians
> during last year's three week war on Gaza.

> My civilian understanding is that the pilot of a jet fighter can in
> most extreme situations bail out explosively and float gently to earth
> in a parachute. His ass might hurt for a couple of days.

> But they don't give parachutes to passengers of civilian jets.


Touché!


That is simply an excellent point Spinoza. However, with my luck I would
probably be able to watch the damn jet crash right into a suburban area
resulting in the slaughter of a dozen or so innocent people! What a fuc%ing
nightmare.


;^(...


So, even though jet fighters are more tolerant to bugs, it's still probably
better to go ahead and use a safer language anyway...


> I conclude that the safety requirements for civilian aviation are
> higher. Unfortunately, Langewiesche doesn't specify what programming
> language was used for the A320's fly by wire software. I really,
> really hope it's something like Ada or Eiffel and not C++.

I have to agree with you on this.


Thank you.


> Pilot: For some reason the bomb bay doors just opened and the plane
> quickly
> became much lighter...
>
> HOLY SHI%!!!!
>
> :^o

== 3 of 5 ==
Date: Wed, Feb 3 2010 10:56 am
From: "Chris M. Thomasson"


"spinoza1111" <spinoza1111@yahoo.com> wrote in message
news:2f609f56-1095-4bb6-81e5-ceda4123bf21@h9g2000prn.googlegroups.com...
On Feb 3, 8:17 pm, "Chris M. Thomasson" <n...@spam.invalid> wrote:
> > "spinoza1111" <spinoza1...@yahoo.com> wrote in message
[...]
> > > The problem was one of computer science, but Kiki, filled with
> > > resentment if not hate, kept whining that it was off topic because C
> > > Sharp could handle the problem with ease.
> >
> > Yes, C# can indeed handle the problem. However, it's not exactly all
> > that
> > "efficient" because it needs to do a full blown copy-on-write and use
> > garbage collection to ensure that everything works as expected. In other
> > words, I cannot operate on data-structures directly like I can using
> > assembly language. FWIW, this is exactly how Sun implemented
> > `AtomicStampedReference'.[...]

> Can't you just let Moore's Law handle "efficiency"?

That's a fair point Edward, however I am highly interested in exploring
techniques that allow software to have excellent scalability, throughput and
performance characteristics on multi-processor systems. If the algorithm
does not scale well, then it's basically dead in the water wrt upcoming
many-core systems.


IMHO, it's not really enough anymore to simply think in terms of `faster
clock rate's = faster software'. Instead, you need to think about how your
software can possibly scale up and adapt to a new system that might have 5
to 10 times the number of processors that you are normally accustomed to
working with. For instance, imagine a software product that runs great on a
4-core system. Then one it's users purchases a 64-core system and installs
said software and does not see any speedup whatsoever. Well, the call to
customer service might go something like:


"I just purchased one of those new multi-core systems, and your application
suite seems to execute critical tasks a little bit slower than usual! Why is
that? Do I have to set some special configuration options? Please help..."


That's right, a poorly written multi-threaded application could actually
perform worse in a multi-core environment. I believe a company would have an
advertising and promotion advantage if it were able to say:


"Our company has recently accomplished the steps that are necessary in order
to create high-end software that is able to efficiently address the
concurrency revolution that is currently underway in the programming
community."


IMHO, software developers should try and learn how to properly address the
"Rise of the Multi-Core Machines!" in order to create quality highly
scaleable products that the consumers deserve. FWIW, here is an article by
Herb Sutter that just might be of interest to you:

http://www.gotw.ca/publications/concurrency-ddj.htm


> Sure, not everything can be interpreted since this would multiply all
> times by a constant or even a variable number of times because when
> things are interpreted, something happens for each instruction. But as
> I have shown, C sharp is compiled at the last minute and not
> interpreted.

> In my view, garbage collection is such a great thing that we shouldn't
> be sad that it happens.

I think that garbage collection is an extraordinary convenient tool indeed
and, IMVHO, it's definitely worthwhile to try and reduce the
"burden/pressure" on it in order to help make it's job "easier". So, I think
that some forms of manual memory management can indeed be beneficial in a
fully garbage collected environment. For instance, something as simple as an
object cache can potentially help out things out:


Imagine a simple container in which you push/pop references to objects. Now,
on every push operation you allocate an internal node to hold the reference
and insert it into the collection. On every pop you remove a node a return
the reference. No need to explicitly free any internal nodes because the GC
just handles all if it for you; very nice! However, this can begin to build
up nodes that "do not necessarily have to exist". Think of pushing and
popping 10,000 nodes. Now, those 10,000 nodes might still exist even though
the collection is completely empty. Then you push and pop 10,000 more. Now
there might be 20,000 nodes floating around waiting for the GC to kick in
and clean everything. This is due to the non-deterministic nature of a
general purpose GC.

Okay, so what would happen if you used a simple node cache? The push
operation would check the cache and only allocate new nodes if it was empty.
The pop operation just sticks popped nodes into said cache if the number of
nodes it currently contains is below a certain threshold, say 50,000 nodes.
In this scenario, when you push/pop 10,000 nodes and then push/pop 10,000
more you are guaranteed to only have 10,000 nodes in existence. Therefore, I
kind of think that the GC would be fairly happy that you actually took the
time to take some of the pressure off of it. Yes, this is definitely a form
of manual memory management which is more complicated and error prone, but
it does have it's perks... ;^)


Is that making any sense Edward?


> However, I have NEVER programmed OSen or embedded systems for real
> money, although I've written a number of compilers. I understand that
> absolute performance goals may apply. I do object to treating
> performance speed as an unalloyed good when the customer doesn't ask
> for it.

I think that one class of software than can benefit from heavy optimizations
could be database servers. If a company upgrades their server farms with
higher end systems that have many more cores inside of them and your
database software does not scale up, well, then they are probably going to
be extremely pissed of. I would not want to receive that phone call; yikes!

:^o

== 4 of 5 ==
Date: Wed, Feb 3 2010 10:58 am
From: "Chris M. Thomasson"


"spinoza1111" <spinoza1111@yahoo.com> wrote in message
news:eda2c3d3-8117-42b2-945d-6e3ec3e8eebc@k6g2000prg.googlegroups.com...
On Feb 3, 11:31 pm, "Chris M. Thomasson" <n...@spam.invalid> wrote:
[...]
> > WOW! I must be a STUPID ASS RETARD or something!!
> >
> > A fairly nice portable solution was staring me right in the damn face
> > Spinoza. I can simply implement one of my new inventions, a wait-free
> > word-based proxy garbage collector algorithm, in C#:
> >
> > http://groups.google.com/group/comp.programming.threads/browse_frm/th...
> >
> > This would completely solve ABA, and take a shi%load of pressure off the
> > C#
> > garbage collector. This would even be useful in Java and it would
> > definitely, beyond a reasonable doubt, beat the living crap out of a
> > solution based on Sun's implementation of the `AtomicStampedReference'.
> > The
> > solution would be in 100% pure C#, and therefore retain all of the
> > benefits
> > of managed code. The funny/odd thing is that I am using a "garbage
> > collector" to help out a garbage collector; very interesting...
> >
> > Now, I still will not be able to "instantly" reuse objects, however, the
> > fact that I can take a lot of pressure off the GC is very attractive.

> Great! But again, your work is in part over my head. I am glad to have
> assisted you even if I have done so inadvertently as it were it a fit
> of absent mindedness.

I thank you for your valuable time and assistance Spinoza, I really do
appreciate it.

:^)

== 5 of 5 ==
Date: Wed, Feb 3 2010 11:01 am
From: richard@cogsci.ed.ac.uk (Richard Tobin)


In article <780ef6e1-6429-46de-a089-c3276d1ea929@p13g2000pre.googlegroups.com>,
spinoza1111 <spinoza1111@yahoo.com> wrote:

>Now the compiler
>can fix it by generating an extra machine instruction to return a
>zero.

I don't see that as fixing it. It should be an error.

Zero is a fairly common return value for integer functions, so it
might be a reasonable default. But why have a default at all? Is the
gain in this case worth missing a fairly common programmer mistake?

And what if the function doesn't return an integer? In particular,
what will you do if it returns a structure?

-- Richard
--
Please remember to mention me / in tapes you leave behind.

==============================================================================
TOPIC: Macro to manipulate chars inside string
http://groups.google.com/group/comp.lang.c/t/9d5125687dd742c0?hl=en
==============================================================================

== 1 of 8 ==
Date: Wed, Feb 3 2010 9:38 am
From: Andre


I wasn't clear enough.

The value I have will be in the following format 75B22636-668E-11CF-
A6D900AA0062CE6C, and I would like to transform it into {(char)0x75,
(char)0xB2, (char)0x26, (char)0x36, (char)0x66, ... , (char)0x6C}.

Thanks,

Andre


== 2 of 8 ==
Date: Wed, Feb 3 2010 9:45 am
From: Ben Pfaff


Andre <sieg1974@yahoo.com> writes:

> I wasn't clear enough.
>
> The value I have will be in the following format 75B22636-668E-11CF-
> A6D900AA0062CE6C, and I would like to transform it into {(char)0x75,
> (char)0xB2, (char)0x26, (char)0x36, (char)0x66, ... , (char)0x6C}.

Do you get this value at runtime or compile time?
--
Ben Pfaff
http://benpfaff.org


== 3 of 8 ==
Date: Wed, Feb 3 2010 9:49 am
From: Andre


On Feb 3, 9:45 am, Ben Pfaff <b...@cs.stanford.edu> wrote:
> Andre <sieg1...@yahoo.com> writes:
> > I wasn't clear enough.
>
> > The value I have will be in the following format 75B22636-668E-11CF-
> > A6D900AA0062CE6C, and I would like to transform it into {(char)0x75,
> > (char)0xB2, (char)0x26, (char)0x36, (char)0x66, ... , (char)0x6C}.
>
> Do you get this value at runtime or compile time?
> --
> Ben Pfaffhttp://benpfaff.org

Compile time


== 4 of 8 ==
Date: Wed, Feb 3 2010 9:53 am
From: Ben Pfaff


Andre <sieg1974@yahoo.com> writes:

> On Feb 3, 9:45 am, Ben Pfaff <b...@cs.stanford.edu> wrote:
>> Andre <sieg1...@yahoo.com> writes:
>> > I wasn't clear enough.
>>
>> > The value I have will be in the following format 75B22636-668E-11CF-
>> > A6D900AA0062CE6C, and I would like to transform it into {(char)0x75,
>> > (char)0xB2, (char)0x26, (char)0x36, (char)0x66, ... , (char)0x6C}.
>>
>> Do you get this value at runtime or compile time?
>
> Compile time

Can you give an example?
--
char a[]="\n .CJacehknorstu";int putchar(int);int main(void){unsigned long b[]
={0x67dffdff,0x9aa9aa6a,0xa77ffda9,0x7da6aa6a,0xa67f6aaa,0xaa9aa9f6,0x11f6},*p
=b,i=24;for(;p+=!*p;*p/=4)switch(0[p]&3)case 0:{return 0;for(p--;i--;i--)case+
2:{i++;if(i)break;else default:continue;if(0)case 1:putchar(a[i&15]);break;}}}


== 5 of 8 ==
Date: Wed, Feb 3 2010 11:55 am
From: Keith Thompson


Andre <sieg1974@yahoo.com> writes:
> On Feb 3, 9:45 am, Ben Pfaff <b...@cs.stanford.edu> wrote:
>> Andre <sieg1...@yahoo.com> writes:
>> > I wasn't clear enough.
>>
>> > The value I have will be in the following format 75B22636-668E-11CF-
>> > A6D900AA0062CE6C, and I would like to transform it into {(char)0x75,
>> > (char)0xB2, (char)0x26, (char)0x36, (char)0x66, ... , (char)0x6C}.
>>
>> Do you get this value at runtime or compile time?
>
> Compile time

75B22636-668E-11CF-A6D900AA0062CE6C is not a valid piece of C code.

Do you have a string literal in your program? How did it get there?

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


== 6 of 8 ==
Date: Wed, Feb 3 2010 12:17 pm
From: jacob navia


Andre a écrit :
> I wasn't clear enough.
>
> The value I have will be in the following format 75B22636-668E-11CF-
> A6D900AA0062CE6C, and I would like to transform it into {(char)0x75,
> (char)0xB2, (char)0x26, (char)0x36, (char)0x66, ... , (char)0x6C}.
>
> Thanks,
>
> Andre

You are trying to transform a string uuid into an uuid:

Use:

Under windows:

#include <rpc.h>
RPC_STATUS RPC_ENTRY UuidFromString(
unsigned char __RPC_FAR *StringUuid,
UUID __RPC_FAR *Uuid
);

Under linux:
#include <uuid/uuid.h>

int uuid_parse( char *in, uuid_t uu);

DESCRIPTION
The uuid_parse function converts the UUID string given by in into the binary representation. The
input UUID is a string of the form 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb (in printf(3) format
"%08x-%04x-%04x-%04x-%012x", 36 bytes plus the trailing '\0').

jacob


== 7 of 8 ==
Date: Wed, Feb 3 2010 1:13 pm
From: Seebs


On 2010-02-03, Andre <sieg1974@yahoo.com> wrote:
> I wasn't clear enough.
>
> The value I have will be in the following format 75B22636-668E-11CF-
> A6D900AA0062CE6C, and I would like to transform it into {(char)0x75,
> (char)0xB2, (char)0x26, (char)0x36, (char)0x66, ... , (char)0x6C}.

This is still pretty unclear.

Do you want a literal translation at compile time, where you'll have a
compile-time string 75B2..., and you want to transform it into a
compile-time string { (char) ...}?

Or do you have incoming data at runtime, and you want to translate it into
a series of values in an array?

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!


== 8 of 8 ==
Date: Wed, Feb 3 2010 1:16 pm
From: Peter Nilsson


Andre <sieg1...@yahoo.com> wrote:
> I wasn't clear enough.
>
> The value I have will be in the following format 75B22636-
> 668E-11CF-A6D900AA0062CE6C, and I would like to transform
> it into {(char)0x75, (char)0xB2, (char)0x26, (char)0x36,
> (char)0x66, ... , (char)0x6C}.

How does it get from the original source into your C source?
Can you supply 75B22636,668E,11CF,A6D900AA0062CE6C instead?
Then you can use a variant of Richard's method (if you have
a compiler that supports unsigned long long.)

#include <stdio.h>

#define UUID(p0, p1, p2, p3) \
{ UUID_X4(p0), UUID_X2(p1), UUID_X2(p2), UUID_X8(p3) }

#define UUID_X8(p1) UUID_8(0x ## p1 ## ull)
#define UUID_X4(p1) UUID_4(0x ## p1 ## ul )
#define UUID_X2(p1) UUID_2(0x ## p1 ## u )

#define UUID_8(x) UUID_4((x) >> 32), UUID_4(x)
#define UUID_4(x) UUID_2((x) >> 16), UUID_2(x)
#define UUID_2(x) UUID_1((x) >> 8), UUID_1(x)
#define UUID_1(x) ((x) & 0xFF)

#define countof(x) ((size_t) (sizeof (x) / sizeof *(x)))

int main(void)
{
size_t i;
unsigned char uuid[] = UUID(75B22636,668E,11CF,A6D900AA0062CE6C);

for (i = 0; i < countof (uuid); i++)
printf(" %02X", 0u + uuid[i]);
putchar('\n');

return 0;
}

--
Peter

==============================================================================
TOPIC: (((( ۞))))wholesale cheap belts, shoes, handbags, purse and T-
shirts etc at www.ecyaya.com
http://groups.google.com/group/comp.lang.c/t/fa8b03986ffabfb2?hl=en
==============================================================================

== 1 of 3 ==
Date: Wed, Feb 3 2010 9:40 am
From: hero


(((( ۞))))wholesale cheap belts, shoes, handbags, purse and T-shirts
etc at www.ecyaya.com

cool belts
the hottest Afflirtion Belt with high quality and low price on www.ecyaya.com

the hottest Armani Belt with high quality and low price on www.ecyaya.com

the hottest Bape Belt with high quality and low price on www.ecyaya.com

the hottest Boss Belt with high quality and low price on www.ecyaya.com

the hottest Burberry Belt with high quality and low price on www.ecyaya.com

the hottest C.D Belt with high quality and low price on www.ecyaya.com

the hottest Chanel Belt with high quality and low price on www.ecyaya.com

the hottest CK Belt with high quality and low price on www.ecyaya.com

the hottest D&G Belt with high quality and low price on www.ecyaya.com

the hottest Diesel Belt with high quality and low price on www.ecyaya.com

the hottest DSQ Belt with high quality and low price on www.ecyaya.com

the hottest ED Belt with high quality and low price on www.ecyaya.com

the hottest Gucci Belt with high quality and low price on www.ecyaya.com

the hottest Hermes Belt with high quality and low price on www.ecyaya.com

the hottest Levfs Belt with high quality and low price on www.ecyaya.com

the hottest LV Belt with high quality and low price on www.ecyaya.com

the hottest Polo Belt with high quality and low price on www.ecyaya.com

the hottest Prada Belt with high quality and low price on www.ecyaya.com

the hottest Versace Belt with high quality and low price on www.ecyaya.com


== 2 of 3 ==
Date: Wed, Feb 3 2010 9:40 am
From: hero


(((( ۞))))wholesale cheap belts, shoes, handbags, purse and T-shirts
etc at www.ecyaya.com

cool belts
the hottest Afflirtion Belt with high quality and low price on www.ecyaya.com

the hottest Armani Belt with high quality and low price on www.ecyaya.com

the hottest Bape Belt with high quality and low price on www.ecyaya.com

the hottest Boss Belt with high quality and low price on www.ecyaya.com

the hottest Burberry Belt with high quality and low price on www.ecyaya.com

the hottest C.D Belt with high quality and low price on www.ecyaya.com

the hottest Chanel Belt with high quality and low price on www.ecyaya.com

the hottest CK Belt with high quality and low price on www.ecyaya.com

the hottest D&G Belt with high quality and low price on www.ecyaya.com

the hottest Diesel Belt with high quality and low price on www.ecyaya.com

the hottest DSQ Belt with high quality and low price on www.ecyaya.com

the hottest ED Belt with high quality and low price on www.ecyaya.com

the hottest Gucci Belt with high quality and low price on www.ecyaya.com

the hottest Hermes Belt with high quality and low price on www.ecyaya.com

the hottest Levfs Belt with high quality and low price on www.ecyaya.com

the hottest LV Belt with high quality and low price on www.ecyaya.com

the hottest Polo Belt with high quality and low price on www.ecyaya.com

the hottest Prada Belt with high quality and low price on www.ecyaya.com

the hottest Versace Belt with high quality and low price on www.ecyaya.com


== 3 of 3 ==
Date: Wed, Feb 3 2010 9:40 am
From: hero


(((( ۞))))wholesale cheap belts, shoes, handbags, purse and T-shirts
etc at www.ecyaya.com

cool belts
the hottest Afflirtion Belt with high quality and low price on www.ecyaya.com

the hottest Armani Belt with high quality and low price on www.ecyaya.com

the hottest Bape Belt with high quality and low price on www.ecyaya.com

the hottest Boss Belt with high quality and low price on www.ecyaya.com

the hottest Burberry Belt with high quality and low price on www.ecyaya.com

the hottest C.D Belt with high quality and low price on www.ecyaya.com

the hottest Chanel Belt with high quality and low price on www.ecyaya.com

the hottest CK Belt with high quality and low price on www.ecyaya.com

the hottest D&G Belt with high quality and low price on www.ecyaya.com

the hottest Diesel Belt with high quality and low price on www.ecyaya.com

the hottest DSQ Belt with high quality and low price on www.ecyaya.com

the hottest ED Belt with high quality and low price on www.ecyaya.com

the hottest Gucci Belt with high quality and low price on www.ecyaya.com

the hottest Hermes Belt with high quality and low price on www.ecyaya.com

the hottest Levfs Belt with high quality and low price on www.ecyaya.com

the hottest LV Belt with high quality and low price on www.ecyaya.com

the hottest Polo Belt with high quality and low price on www.ecyaya.com

the hottest Prada Belt with high quality and low price on www.ecyaya.com

the hottest Versace Belt with high quality and low price on www.ecyaya.com

==============================================================================
TOPIC: Didn't get Ben Pfaff code (chapter 12 of The Book).
http://groups.google.com/group/comp.lang.c/t/29a7d514c784cee3?hl=en
==============================================================================

== 1 of 2 ==
Date: Wed, Feb 3 2010 9:40 am
From: grishin-mailing-lists@minselhoz.samara.ru


Hello,

Now I'm reading Unleashed C, a book written by the community.
I like the style it's written. There are a lot of fun, I appreciate
it. Thank you guys.

There is a point I can't get for the last 2 days, though Ben explained
it. Possible the hassle is due to a poor translation from English into
Russian (Unfortunately I'm reading a translation).

Here we have a double pointer "new". I can't get what is it for and
the way it's used.

/* bin.c lines 79-109 */
int bin_insert(struct bin_tree *tree, int item)
{
struct bin_node *node, **new;

assert(tree != NULL);
new = &tree->root;
node = tree->root;
for (;;) {
if (node == NULL) {
node = malloc(sizeof *node);
*new = node;
if (node != NULL) {
node->data = item;
node->left = node->right = NULL;
tree->count++;
return 1;
}
else
return 0;
}
else if (item == node->data)
return 2;
else if (item > node->data) {
new = &node->right;
node = node->right;
}
else {
new = &node->left;
node = node->left;
}
}
}

On one hand the value stored in the variable has never been used. On
the other hand I tried to comment all "new" entries and eventually the
program doesn't work properly printing
D:\projects\MinGW\ch12\wpj>noname.exe
Seed value = 23488
Inserted 11:
Tree has 0 nodes, but tree count is 1.
Error(s) encountered, aborting execution.

So it used in a mysterious way (as for me).

In addition the same technique is used afterwards so I can't sluff it
(otherwise I would be sensible to skip the chapter altogether).

Thank you in advance.

--
Yuriy Grishin
http://gateway11.ath.cx/


== 2 of 2 ==
Date: Wed, Feb 3 2010 9:50 am
From: Ben Pfaff


grishin-mailing-lists@minselhoz.samara.ru writes:

> Here we have a double pointer "new". I can't get what is it for and
> the way it's used.

[...]

> On one hand the value stored in the variable has never been used.

Sure it gets used. "new" tracks the pointer that was
dereferenced to arrive at "node". When "node" turns out to be
NULL, the function assigns to *new to update that pointer.

I probably wouldn't write this code exactly this way any longer,
but I do believe that it is correct.
--
char a[]="\n .CJacehknorstu";int putchar(int);int main(void){unsigned long b[]
={0x67dffdff,0x9aa9aa6a,0xa77ffda9,0x7da6aa6a,0xa67f6aaa,0xaa9aa9f6,0x11f6},*p
=b,i=24;for(;p+=!*p;*p/=4)switch(0[p]&3)case 0:{return 0;for(p--;i--;i--)case+
2:{i++;if(i)break;else default:continue;if(0)case 1:putchar(a[i&15]);break;}}}

==============================================================================
TOPIC: free c text book advice..
http://groups.google.com/group/comp.lang.c/t/adf51d19d9b07faf?hl=en
==============================================================================

== 1 of 6 ==
Date: Wed, Feb 3 2010 9:59 am
From: Squeamizh


On Feb 2, 9:20 pm, c...@tiac.net (Richard Harter) wrote:
> On Wed, 03 Feb 2010 01:14:01 +0000, Richard Heathfield
>
> <r...@see.sig.invalid> wrote:
>
> [snip]
>
> >Only a complete idiot would consider that a recommendation. This
> >newsgroup appears to have no shortage of idiots.
>
> This sort of thing is one reason why you raise people's hackles.
> Calling people idiots, stupid, losers and the like is common
> enough among bright progammers.  It's a trap.  People do not
> respond well to perceived arrogance and condescension.

Eh, whatever. They truly are idiots. Saying "this book meets your
requested criteria, but I don't know if it's any good" is obviously
not a recommendation, and trying to argue civilly with someone who
disagrees is a big fat waste of time. This entire thread has become a
joke, and at this point, Richard Heathfield is justified in throwing
out any insults that come to mind.


== 2 of 6 ==
Date: Wed, Feb 3 2010 11:57 am
From: "Default User"


Nick Keighley wrote:

> but there comes a point when their idocy is so plain that "complete
> idiot" is the only way to describe them. I'll give Jacob a free pass
> as he's a non-native speaker (though he does look like he just wants a
> poke at Richard Heathfield) but Richard <noname> and twinky are just
> arguing for the sake of arguing.

Which then raises the question, "why is anyone reading their posts, let
alone answering them?"

Brian

--
Day 366 of the "no grouchy usenet posts" project


== 3 of 6 ==
Date: Wed, Feb 3 2010 12:33 pm
From: Richard


"Default User" <defaultuserbr@yahoo.com> writes:

> Nick Keighley wrote:
>
>> but there comes a point when their idocy is so plain that "complete
>> idiot" is the only way to describe them. I'll give Jacob a free pass
>> as he's a non-native speaker (though he does look like he just wants a
>> poke at Richard Heathfield) but Richard <noname> and twinky are just
>> arguing for the sake of arguing.
>
> Which then raises the question, "why is anyone reading their posts, let
> alone answering them?"
>
> Brian

Primarily because we tend to offer a lot more about C than your
typically vacant, empty, useless follow up posts which seem to do
nothing but net nanny like you just did. Again.

That why.

--
"Avoid hyperbole at all costs, its the most destructive argument on
the planet" - Mark McIntyre in comp.lang.c


== 4 of 6 ==
Date: Wed, Feb 3 2010 12:52 pm
From: santosh


Dag-Erling Smørgrav wrote:
> santosh <santosh.k83@gmail.com> writes:
> > <http://www.iu.hio.no/~mark/CTutorial/CTutorial.html>
>
> Please, no, stay away from this one. It is riddled with typographical
> and factual errors, pseudo-jargon, hand-waving and plain bad advice.

Thanks for the heads-up.

Serves me right for giving a link without checking it out.
--
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.


== 5 of 6 ==
Date: Wed, Feb 3 2010 12:59 pm
From: Albert


jacob navia wrote:
<snip>
> If Heathfield did NOT recommend that book WHAT did he do?
<snip>

He put the title of a book in a sentence, in a reply.


== 6 of 6 ==
Date: Wed, Feb 3 2010 1:12 pm
From: Seebs


On 2010-02-03, Default User <defaultuserbr@yahoo.com> wrote:
>> but there comes a point when their idocy is so plain that "complete
>> idiot" is the only way to describe them. I'll give Jacob a free pass
>> as he's a non-native speaker (though he does look like he just wants a
>> poke at Richard Heathfield) but Richard <noname> and twinky are just
>> arguing for the sake of arguing.

> Which then raises the question, "why is anyone reading their posts, let
> alone answering them?"

No clue. I plonked them as soon as I established that they were content-free.

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!

==============================================================================
TOPIC: Copying one array to another array
http://groups.google.com/group/comp.lang.c/t/b8577e4d80b55c5d?hl=en
==============================================================================

== 1 of 1 ==
Date: Wed, Feb 3 2010 11:59 am
From: Eric Sosman


On 2/3/2010 11:17 AM, bartc wrote:
>
> "janus" <emekamicro@gmail.com> wrote in message
> news:fbabffc9-7dd1-42bd-bef7-cee402f7ab57@z26g2000yqm.googlegroups.com...
>> Hello All,
>>
>> I was not able to carry out the below,
>>
>> int array1 = {{2,1},{1,0}};
>> int array2 = {{3, 5},{7,9}};
>>
>> array2 = array1;
>>
>> I got incompatible type error.
>>
>> My only saving grace was memcpy... Now, I would want somebody to
>> explain why array to array copying failed.
>
> C can't do assignments of arbitrary length, except for structs.

Nitpick: "and unions."

> C can't do assignments of arbitrary length, except for structs. If a
> compatible struct is defined (and it just needs to have the same number
> of bytes as the array), then the following is possible:
>
> #include "stdio.h"
> #include "stdlib.h"
>
> typedef struct{int array[2][2];} intarray22;
>
> int main(void) {
> int array1[2][2] = {{10,20},{30,40}};
> int array2[2][2] = {{0,0},{0,0}};
>
> *(intarray22*)array2 = *(intarray22*)array1;

Non-nitpick: I don't think this is guaranteed to work.
It is possible that sizeof(intarray22) > 2*2*sizeof(int) --
that is, your parenthetical remark might not hold. There
could be alignment problems, too.

--
Eric Sosman
esosman@ieee-dot-org.invalid


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

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