Tuesday, April 20, 2010

comp.lang.c - 9 new messages in 5 topics - digest

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

comp.lang.c@googlegroups.com

Today's topics:

* seebs/schildt - 3 messages, 2 authors
http://groups.google.com/group/comp.lang.c/t/0c84debf9a4f144b?hl=en
* OT: [NILGES] portability [Was: In the Matter of Herb Schildt:...] - 1
messages, 1 author
http://groups.google.com/group/comp.lang.c/t/caf17fab4e7d8530?hl=en
* Cheap Wholesale Lacoste Shoes - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/94c91e88d44730ea?hl=en
* Generic programming in C - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c/t/efedbc3e3c37ccc1?hl=en
* string literal declaration - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c/t/a711d196f746ce7b?hl=en

==============================================================================
TOPIC: seebs/schildt
http://groups.google.com/group/comp.lang.c/t/0c84debf9a4f144b?hl=en
==============================================================================

== 1 of 3 ==
Date: Mon, Apr 19 2010 10:17 pm
From: spinoza1111


On Apr 17, 11:08 pm, Mark <s...@not.welcome.here.ac.uk> wrote:
> spinoza1111<spinoza1...@yahoo.com> wrote:
> > On Apr 17, 5:10 pm, Mark <s...@not.welcome.here.ac.uk> wrote:
> >>spinoza1111<spinoza1...@yahoo.com> wrote:
>
> >> > Which is why Andrew Tanenbaum (from whomTorvaldsstole Minix) was
> >> > right about Linux.
>
> >> The idea thatTorvaldsstole Minix was largely hyped up by a few people
> >> during the early years of the SCO-Novell court case.  Even early
> >> versions shared little with Minix (mainly the filesystem code to get
> >> that side up and running until a new filesystem was put in place - which
> >> it was).  This has largely been described as "scaffolding" and, like
> >> structural scaffolding in the "physical world", it's not part of the
> >> final product.
>
> > Even ifTorvaldswrote the code, he did no real creative design.
> > Tanenbaum and the developers of unix need to be credited with that.
>
> >> Even if you really believedTorvaldswas in the habit of stealing code,
>
> > I think that in general hackers and (with the exception of Stallman)
> > open source coders are in the habit of stealing intellectual
> > production (which doesn't only include "code" but also includes
> > ideas), and they've been in this habit ever since they stole Basic
> > from Gates and his team in the 1970s. I think they add insult to
> > injury by marshaling attacks on the victim as is seen here with
> > respect to Navia. They also work as slaves.
>
> > Their theft creates resources for big companies. Their slave mentality
> > destroys jobs. Their mob rule has destroyed the very idea of
> > reputation.
>
> Some, not all.  There is a lot of innovation in that community.  That
> there is also a lot of copying doesn't change that.
>
> If you apply the same thing to all of industry, you could make precisely
> the same observation.
>
> As for Gates, he has borrowed most of his ideas too; BASIC was no more
> original than most other code at the time, he simply (and perfectly
> sensibly) decided to control it as property.
>
> (I can't help pointing out, however, that "theft" has a specific legal
> meaning which doesn't apply to software where you are not depriving the
> person of their personal possessions).
>
> >> think about it for a minute: Minix and Linux are fundamentally different
>
> > Not in essentials. They are based on a command line interface and a
> > monolithic design with too many dependencies between levels that
> > should be separated.
>
> If you think the command line is the essence of Unix, you have missed
> almost the entire point.  The command line is a common feature, but the
> more important features in a modern unix-like system was to do with its
> abstractions (whether VFS, security model, memory model, network layer,
> whatever).
>
> Whilst you could argue that your criticisms about dependencies apply to
> Linux (though there are counter-arguments), how do you claim this for
> Minix?  Minix is designed to be a Microkernel, and the subsystems are
> separated and communicate through the (traditional microkernel) message
> passing.  This is why I say you're wrong that Linux and Minix are
> closely related.
>
> Why do you believe you're right?
>
> >> designs, and the core difference (the whole microkernel vs. monolithic
> >> kernel debate) is so significant, it simply isn't possible to take one,
> >> "steal it" and turn it into the other.  Sure, you could take concepts or
> >> small parts of code and refactor them to work with the different
> >> architecture, but most of the time you'd be creating even more work.
>
> > Code is not ideas. The development of Linux was marked in fact by a
> > stunning lack of originality. It "is", from a standpoint of design,
> > unix. Cf. Jaron Lanier ("You Are Not a Gadget", 2010).
>
> Code can be the *expression* of ideas, particularly when well-executed.
>
> Linux was deliberately designed to be useful in the real world.  It was
> designed against standards (things like the POSIX standards, the SuS,
> SVRX and other similar documents) so that real software would be trivial
> to port.  This is what has guided a lot of its *interface* decisions.
>
> On either side of the interfaces*, however, there has been plenty of
> innovation, with all sorts of interesting work coming out of it.
>
> Does that mean that closed-source is bad?  I don't think so.
>
> Does the stilted copycat projects that exist in open-source mean
> open-source is devoid of invention?  I don't think that either.
>
> * And even some of the interfaces have developed.  This has not been
>   without controversy.
>
>
>
>
>
> >> Don't believe me?  Forget a short, intemperate debate in 1992 and read
> >> this piece from the man himself (Professor Andrew S. Tanenbaum) from May
> >> 2004:
>
> >>    http://linux.sys-con.com/node/44969
>
> >> Amongst other things, he says:
>
> >>     "He thought I would back up his crazy claim that Linus stole Linux
> >>     from me. Brown was wrong on two counts. First, I bear no 'grudge'
> >>     against Linus at all. He wrote Linux himself and deserves the
> >>     credit. Second, I am really not a mean person. Even if I were still
> >>     angry with him after all these years, I wouldn't choose some sleazy
> >>     author with a hidden agenda as my vehicle. My home page gets 2500
> >>     hits a week. If I had something to say, I could put it there."
>
> >>     "To the extent that Linus can be counted as my student, I'm proud of
> >>     him, too. Professors like it when their students go on to greater
> >>     glory."
>
> >>     "Linus seems to be doing excellent work and I wish him much success
> >>     in the future. "
>
> >> So, even Andrew S. Tanenbaum clearly states thatTorvaldsdidn't steal
> >> from Minix.
>
> > What's interesting is that Professor Tanenbaum had to eat shit, and
> > there was no corresponding apology for the flame war fromTorvalds,
>
> Again, you are wrong.  Torvaldsapologised to him at the time and has
> repeated that apology since.  As far as I can see, there are no hard
> feelings on either side.
>
> > the victor who went on to be a millionaire while Tanenbaum remains a
> > professor, unrecognized for minix and unrecognized for pointing out
> > the facts, which include the fact that Linux stopped OS development in
> > its tracks. As far as I know, Linux doesn't even solve the 2038 date
> > overflow problem (I hope I am wrong).
>
> As Tanenbaum has stated clearly (in fact, in the same article I
> referenced) he was (and is) more interested in his academic career than
> having a successful career focused on Minix.  I don't know howTorvalds
> has done or if he *is* a millionaire, but I don't understand why you
> wish to turn him into a bad guy.
>
> There *is* no "fact" that Linux stopped OS development in its tracks.
> That's just something you want to assert.  OS development has certainly
> slowed but (I'd *assert*) this is more to do with the fact that kernels
> became "good enough" and the CS community has been more interested in
> other challenges in middleware and elsewhere.  Finding ways to
> distribute code across cores and systems (locally or globally) are the
> route to Ph.D.s now.  Is that Linux's (or Torvald's) fault?  No more
> than it's Microsoft's, Sun's or Apple's fault.
>
> You are also wrong that Tanenbaum is unrecognised for Minix.  Sure, he's
> not known outside of CS whileTorvaldsis (to a greater extent), but he
> never *was* known outside of the CS community.  How hasTorvaldsfame
> cost him?  If anything, it drew attention to Minix and has written him
> another page in history.  I must say, however, Minix is not his most
> important work in my opinion.
>
> Finally, the 2038 problem is as solved as it can be.  The standard
> time_t for 64 bit systems (which any serious system these days will be)
> is 64 bits.  That gives us more time than I'm going to worry about
> (many, many millennia).  There are some minor issues in 64 bit Unix like
> library support for dates in the far-future:
>
>    - HPUX only recognise up to Dec 31 9999, 23:59:59 UTC
>      in their 64 bit systems for functions like "ctime"
>    - glibc on Fedora 12, x86_64 only seems to handle up to
>      Dec 31 2147483647, 23:59:59 UTC.  I can live with this.
>
> The biggest problems can't be solved by the OS designers, however, and
> that's where people have written code with the assumptions in the code,
> particularly where people aren't using time_t and/or are abusing the
> type in the way they perform arithmetic.  This would be the case no
> matter which language or OS you were dealing with.
>
> As with Y2K, it will depend on code review.  People running shoddy code
> have work to do, particularly if the code is heading to overruns earlier
> (the classic example being banks calculating mortgage repayments over
> 25/30 year terms).
>
> > > Are you going to keep repeating this or concede that you are wrong?
> > > An apology to Mr.Torvaldsmight be in order too, but I'll leave that
> > > to your conscience.
>
> > I don't think he cares. He's made his pile. That's all that counts in
> > this business.
>
> If that were the case, it would make your pursuit of Seebs on behalf of
> Schildt even harder to explain.
>
> You have accusedTorvaldsof being a thief (amongst other things).
> Whether or not you retract and apologise is entirely up to you.
>
> As forTorvalds, you are almost certainly right he doesn't care.  He's
> big enough and smart enough to defend himself even if he does, so I
> won't patronise him by pretending otherwise.  I'm certain that's the
> position someone like Herb Schildt would take too.
>
> This doesn't make your wild assertions correct, though.  Are you big
> enough to concede the points I've made here?
>
> It's entirely up to you.

Let's take a look at Torvalds' reply to Tanenbaum's polite and
reasoned 1992 post, "Linux is obsolete":

http://oreilly.com/catalog/opensources/book/appa.html

Torvalds: "You use this as an excuse for the limitations of minix?
Sorry, but you
loose: I've got more excuses than you have, and linux still beats the
pants of minix in almost all areas. Not to mention the fact that most
of the good code for PC minix seems to have been written by Bruce
Evans."

Two half-literate spelling errors and a grandiose claim. Linux "beat
the pants off" minix only in empirical speed for chips of 1992. To say
this was a win was to be ignorant of Moore's Law.

Torvalds: "Re 1: you doing minix as a hobby - look at who makes money
off minix,
and who gives linux out for free. Then talk about hobbies. Make
minix
freely available, and one of my biggest gripes with it will
disappear.
Linux has very much been a hobby (but a serious one: the best type)
for
me: I get no money for it, and it's not even part of any of my studies
in the university. I've done it all on my own time, and on my own
machine."

Torvalds is anticipating millions at this point because he's creating,
unlike Tanenbaum, a resource for IBM that virtual slave labor will
complete, not him; and if any of these coding slaves get uppity they
will be savaged in public as I am. Torvalds did indeed become a
millionaire while claiming to be a benefactor of mankind; Tanenbaum
did not, precisely because Torvalds destroyed any opportunity to make
money by writing OSen. News flash: benefactors of mankind feed the
hungry and clothe the naked. They don't clone OSen, and they DON'T
destroy the middle class by deliberately working for free, especially
while living with Mommie and Daddy.

Torvalds: "Re 2: your job is being a professor and researcher: That's
one hell of a
good excuse for some of the brain-damages of minix. I can only hope
(and
assume) that Amoeba doesn't suck like minix does."

The Maoist and Fascist anti-intellectualism starts right here, because
instead of speaking truth to power, it's always safer and more fun to
gang up on professors. It makes you look like a Big Man, like one of
the Nazi thugs let us now say (for let us not speak falsely now the
hour is much too late) that disrupted classes in the Weimar Republic.

These were the Nazis and Maoists who could not write a sentence
without grammar and spelling errors, nor get past a low upper bound of
complexity without confusion, but found the High German of the German
professors too complex and the Four Olds of the Chinese professors
counter-revoltionary even though they could not read classical Chinese
or traditional characters.

This was Torvalds' first response. It is clear that Torvalds set the
style for attacking professors and authors in the name of creating
software by means of slave labor. He was a bitter, twisted little
graduate student who stole Minix. Tanenbaum was basically just to
decent to kick his fucking ass.


== 2 of 3 ==
Date: Mon, Apr 19 2010 10:28 pm
From: spinoza1111


On Apr 20, 1:17 pm, spinoza1111 <spinoza1...@yahoo.com> wrote:
> On Apr 17, 11:08 pm, Mark <s...@not.welcome.here.ac.uk> wrote:From: feustel@netcom.COM (David Feustel)

Look at this shit!

-------------------------------------------------------------------------
Subject: Re: LINUX is obsolete
Date: 30 Jan 92 18:57:28 GMT
Organization: DAFCO - An OS/2 Oasis

ast@cs.vu.nl (Andy Tanenbaum) writes:

>I still maintain the point that designing a monolithic kernel in 1991 is
>a fundamental error. Be thankful you are not my student. You would not
>get a high grade for such a design :-)

That's ok. Einstein got lousy grades in math and physics.
-------------------------------------------------------------------------

So Torvalds is now Einstein? WTF?

Here's the origin of Seebach's vanity career. People just assume,
today, that if they get a bad grade and have a white skin, that they
are Misunderstood Geniuses Who Everyone Laughs At, while they like
Seebach laugh at a person who actually read John Markoff's fascinating
article on the origin of OO design (Simula) in the need of Danish
management to cooperate decently with Danish labor.

They fail, or do not as Seebach does not dare try. Then some
corporation hires them in order to write kiddie scripts and because
they're white and middle class, pays them 75K to start, and gives them
a fancy title.

Contract programmers fix their errors (% anything replaced when %s was
to be replaced, unstructured switch, failure to initialize db_header,
one line strlen all fucked up), take the money and run...or the code
is shipped for fixing to India, where programmers commute three hours
to work in 40C and know their trade.


== 3 of 3 ==
Date: Tues, Apr 20 2010 12:06 am
From: Mark


spinoza1111 <spinoza1111@yahoo.com> wrote:
> On Apr 17, 11:08 pm, Mark <s...@not.welcome.here.ac.uk> wrote:
>>
>> This doesn't make your wild assertions correct, though.  Are you big
>> enough to concede the points I've made here?
>>
>> It's entirely up to you.

Okay - don't show any decency, then. I've presented the evidence.
Where's yours?

Where's the apology?

> Let's take a look at Torvalds' reply to Tanenbaum's polite and
> reasoned 1992 post, "Linux is obsolete":
>
> http://oreilly.com/catalog/opensources/book/appa.html
>
> Torvalds: "You use this as an excuse for the limitations of minix?
> Sorry, but you
> loose: I've got more excuses than you have, and linux still beats the
> pants of minix in almost all areas. Not to mention the fact that most
> of the good code for PC minix seems to have been written by Bruce
> Evans."
>
> Two half-literate spelling errors and a grandiose claim. Linux "beat
> the pants off" minix only in empirical speed for chips of 1992. To say
> this was a win was to be ignorant of Moore's Law.

He was young, and this is 18 years ago. The folly of youth.

> Torvalds: "Re 1: you doing minix as a hobby - look at who makes money
> off minix,
> and who gives linux out for free. Then talk about hobbies. Make
> minix
> freely available, and one of my biggest gripes with it will
> disappear.
> Linux has very much been a hobby (but a serious one: the best type)
> for
> me: I get no money for it, and it's not even part of any of my studies
> in the university. I've done it all on my own time, and on my own
> machine."
>
> Torvalds is anticipating millions at this point because he's creating,

Anticipating millions? Millions of what? Not money. That quote talks
about his unpaid hobby.

> unlike Tanenbaum, a resource for IBM that virtual slave labor will
> complete, not him; and if any of these coding slaves get uppity they
> will be savaged in public as I am. Torvalds did indeed become a
> millionaire while claiming to be a benefactor of mankind; Tanenbaum
> did not, precisely because Torvalds destroyed any opportunity to make
> money by writing OSen. News flash: benefactors of mankind feed the

Tanenbaum made it clear he wasn't seeking to be an OS salesman. You
can't justify this claim.

> hungry and clothe the naked. They don't clone OSen, and they DON'T
> destroy the middle class by deliberately working for free, especially
> while living with Mommie and Daddy.

No - benefactors of mankind do all sorts of things to benefit mankind.
It's you who are imposing your own definition. It's you who are claiming
he was claiming to *be* a benefactor of mankind.

Show the evidence.

Personally, I think he *did* benefit mankind. I think his project has
helped all sorts of people to understand kernel development. In some
cases, it has demonstrated what not to do (there has been more than one
misstep in Linux's design), in others it has demonstrated some very
interesting concepts. This is a *good* thing.

> Torvalds: "Re 2: your job is being a professor and researcher: That's
> one hell of a good excuse for some of the brain-damages of minix. I
> can only hope (and assume) that Amoeba doesn't suck like minix does."
>
> The Maoist and Fascist anti-intellectualism starts right here, because
> instead of speaking truth to power, it's always safer and more fun to
> gang up on professors. It makes you look like a Big Man, like one of
> the Nazi thugs let us now say (for let us not speak falsely now the
> hour is much too late) that disrupted classes in the Weimar Republic.

I show evidence from the right millennium, and you obsess about the
comments of a kid from almost 20 years ago. Comments he has apologised
for.

> These were the Nazis and Maoists who could not write a sentence
> without grammar and spelling errors, nor get past a low upper bound of
> complexity without confusion, but found the High German of the German
> professors too complex and the Four Olds of the Chinese professors
> counter-revoltionary even though they could not read classical Chinese
> or traditional characters.

No - here's a very bright and (too) precocious kid who needed to learn a
little humility. Lots of people say stupid things when young and many,
like Torvalds, will go on to develop. To compare him to Maoists is
ridiculous.

To compare him to Nazis is Godwin's. ;-)

> This was Torvalds' first response. It is clear that Torvalds set the
> style for attacking professors and authors in the name of creating

"Set the style"? He wasn't the first and will not be the last. To
suggest he was the originator of some sort of anti-intellectual backlash
is ridiculous.

> software by means of slave labor.

These would be willing slaves...or, in other words, 'not slaves'.

> He was a bitter, twisted little
> graduate student who stole Minix.

Repeating the claim that he stole Minix doesn't make it true.
Claiming he was bitter and twisted doesn't help make it true.

> Tanenbaum was basically just to
> decent to kick his fucking ass.

You know Tanenbaum's mind better than he does?

==============================================================================
TOPIC: OT: [NILGES] portability [Was: In the Matter of Herb Schildt:...]
http://groups.google.com/group/comp.lang.c/t/caf17fab4e7d8530?hl=en
==============================================================================

== 1 of 1 ==
Date: Mon, Apr 19 2010 10:37 pm
From: spinoza1111


On Apr 19, 11:28 pm, Richard Heathfield <r...@see.sig.invalid> wrote:
> spinoza1111wrote:
> > On Apr 19, 5:30 pm, Ian Collins <ian-n...@hotmail.com> wrote:
> >> On 04/19/10 09:26 PM, Nick Keighley wrote:
>
> >>> On 18 Apr, 17:49,spinoza1111<spinoza1...@yahoo.com>  wrote:
> >>>>>> If you want to write portable code, it is folly to int main(). Use
> >>>>>> Java or C Sharp.
> >>> which need fairly powerful machines, limit what you can do (this may
> >>> be perfectly fine for some applications) and do things that hard real-
> >>> time systems can't tolerate (like garbage collection, and JIT
> >>> compilation).
> >> You overlooked the obvious: C Sharp isn't portable!
>
> > It is. Check out mono. It has no dependencies on Windows.
>
> Does it run on VM/CMS? OS/390? ARMs? SHARCs?

It can be "ported". "mono" is not portable: but given "mono", C Sharp
is.

Sure, C has spread like a virus all over many computers owing to the
willingness of hackers to hack and blame IBM when their timer code
fails.

But this isn't portability.

We're talking about the portability of a programming language, which
means that the set of statements about the preconditions of its
running without change on a new platform.

In the case of the earlier poster this set of statements was:

{Handles endianness same way, is dependent on timer code, needs a C
compiler}

In the case of a C Sharp program this set of statements is a unit set:

{Has .Net/mono}

I teach literature today, and it's all about words. A computer program
(cf Knuth and Dijkstra) is a message about your intentions as regards
using a computer. If your words are a mess, consisting of (vague and
uninstantiated) references to endianness and someone else's bugs,
you're fucked.
>
> --
> Richard Heathfield <http://www.cpax.org.uk>
> Email: -http://www. +rjh@
> "Usenet is a strange place" - dmr 29 July 1999
> Sig line vacant - apply within


==============================================================================
TOPIC: Cheap Wholesale Lacoste Shoes
http://groups.google.com/group/comp.lang.c/t/94c91e88d44730ea?hl=en
==============================================================================

== 1 of 1 ==
Date: Mon, Apr 19 2010 11:16 pm
From: zaqwsx147852


Cheap Wholesale Gucci Shoes (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale GUCCI Boots
Cheap Wholesale Lacoste Shoes
Cheap Wholesale LV Shoes (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale LV Boots
Cheap Wholesale Prada Shoes (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale Timberland Shoes
Cheap Wholesale D&G Shoes (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale D&G Boots
Cheap Wholesale Puma Shoes
Cheap Wholesale Puma AAA (paypal payment)
(http://www.supertradeonline06.com/ )

Cheap Wholesale Bikkem Bergs Shoes (free shipping)
Cheap Wholesale Mauri Shoes Man
Cheap Wholesale Versace Shoes (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale Versace Boots
Cheap Wholesale Paul Smith Shoes (free shipping)
Cheap Wholesale BOSS Shoes
Cheap Wholesale Burberry Shoes (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale Dsquared shoes
Cheap Wholesale Dior Shoes (free shipping)
Cheap Wholesale Dior Boots
Cheap Wholesale ED Hardy Shoes (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale ED Hardy Boots
Cheap Wholesale ED Hardy Shoes Man (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale Fendi Shoes (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale Fendi Boots
Cheap Wholesale AFF Shoes (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale Evisu Shoes (free shipping)
Cheap Wholesale 4US Shoes
Cheap Wholesale Sebago Shoes (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale Supra Shoes
Cheap Wholesale Hight Converse Shoes (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale Coach Boots
Cheap Wholesale Coach Shoes
Women Christian Louboutin (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale Chanel Shoes
Cheap Wholesale Chanel Boots (free shipping)
Cheap Wholesale Bape Shoes
Cheap Wholesale Adidas Shoes (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale Adicolor (free shipping)
Cheap Wholesale Adidas 35TH (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale Adidas NBA
Cheap Wholesale Adidas Running (paypal payment)
(http://www.supertradeonline06.com/ )
Cheap Wholesale Adidas Y3
Cheap Wholesale Soccer Shoes (paypal payment)
(http://www.supertradeonline06.com/ )


==============================================================================
TOPIC: Generic programming in C
http://groups.google.com/group/comp.lang.c/t/efedbc3e3c37ccc1?hl=en
==============================================================================

== 1 of 2 ==
Date: Mon, Apr 19 2010 11:40 pm
From: Nick <3-nospam@temporary-address.org.uk>


"Morris Keesan" <mkeesan@post.harvard.edu> writes:

> On Sat, 17 Apr 2010 04:31:29 -0400, jacob navia <jacob@spamsink.net> wrote:
>
>
>> int strrepl(char *InputString,
>> char *StringToFind,
>> char *StringToReplace,
>> char *output)
>
> Maybe I'm missing something, but this appears to be using a name which
> is reserved for future library extensions (C99 7.26.11). str_repl would
> be a safer name. Also, this would benefit from some judicious use of
> the "const" attribute, so that the reader of the code could tell at a
> glance which of the argument strings are safe from modification. Based
> on a quick skim of the code, I suspect that this could be
>
> int str_repl(const char *InputString,
> const char *StringToFind,
> const char *StringToReplace,
> char *output)
>
> and it would be much nicer to the reader and the compiler to make this
> explicit.

I confess to not having examined the original code, but if that function
does the obvious it looks like a buffer overflow waiting to happen.
--
Online waterways route planner | http://canalplan.eu
Plan trips, see photos, check facilities | http://canalplan.org.uk


== 2 of 2 ==
Date: Tues, Apr 20 2010 12:09 am
From: Nick Keighley


On 19 Apr, 14:41, Michael Foukarakis <electricde...@gmail.com> wrote:
> On Apr 19, 10:17 am, jacob navia <ja...@spamsink.net> wrote:
> > Gene a crit :

[...]

> > > Generating code from templates like this is pretty standard in larger
> > > code bases. But I've generally seen a short script in a language like
> > > awk or perl used to transform the template instead of C.  I think what
> > > you've done in C represents one line of Perl, for example.
>
> > I do not think so, if you look carefully at the code you will see that
> > it does more than what you believe. And in any case, I do not want to
> > force the users of the library to install another programming language
> > and all the associated hassle...
>
> Nobody relies on one programming language for everything. If one
> doesn't know sed/awk, (s)he's doomed anyway.

I never got the hang of sed and I find awk very limited (lack of
anchored patterns). I use perl for what i used to use awk for. It *is*
a bit of pain to have to download it and it is gigantic for what I
want. Serves me right for using Windows.


> > > The down side in a big system with either approach will be code
> > > bloat.
>
> > This is always the case for templates. You can, however, compile all
> > those expanded templates into a library, and the linker will pukll out
> > of that library only those files that are effectively used. The code
> > bloat of the template for the flexible array container is just 2.3K

impressive. On a desk top 2.3k is down in the noise.

> A generic container implemented with pointers to void is equally
> functional and less work for me. What are the reasons that could lead
> me to adopting your approach?

no one is compelling you to use it. The void* appraoch is less
typesafe. Usually pretty ugly too.

> Specifically:
>
> * Even your PoC code is bloated and clearly erroneous (and dangerous)
> in some places.

could we have some specific criticism. If his code is broken or unsafe
we'd like to know why.

> Why would I use it over libraries that provably work
> correctly, and have been for a while now (such as GLib)?

no one is twisting your arm


> * It is my belief is that metaprogramming in C offers no real benefits
> for its hassle,

"C Unleashed" (if I recall corrctly) uses a generic approach (though
less sophisticated tahn Jacob's)

> other than e-penis size.

idiot

> If you disagree, what is the
> real incentive behind C metaprogramming?

type safety. A quick an easy way to produce efficeint container code.

> [REPETITION] given that the language is, by
> design, inadequate for that purpose?

well if he's done it plainly isn't inadequate


> * Memory is generally not an issue at this point. If one is severely
> restricted, a custom container might be desirable

as opposed to what?

> - but such a
> discussion with no practical area of application is moot.

I disagree

> In extreme
> cases one might not need it at all, because the gain from not having
> the need for a pointer to void for each data element might be
> significant, but if that gain is maximum then I'm better off using C
> arrays and finding clever algorithms to manipulate the data..
>
> * Can you show me an application which uses your scheme effectively
> and demonstrably benefits over "void *" containers?

I think you've already made your mind up.


--

You are in a clearing. You can see a spire in the distance.
You can also see a copy of "C Unleashed".
: INV
You have;
a DeathStation 900 laptop,
a voucher for a free pizza,
and a torch.
: TAKE BOOK
You can't. It's too heavy.
Bill Godfrey (clc)

==============================================================================
TOPIC: string literal declaration
http://groups.google.com/group/comp.lang.c/t/a711d196f746ce7b?hl=en
==============================================================================

== 1 of 2 ==
Date: Mon, Apr 19 2010 11:42 pm
From: Nick <3-nospam@temporary-address.org.uk>


Peter Nilsson <airia@acay.com.au> writes:

> Ian Collins <ian-n...@hotmail.com> wrote:
>> >     I was trying to understand some code and came across a
>> > string literal definition as:
>> > char a[]="abc""def";    // string-1
>> >
>> >    I had seen eariler only string literal with characters
>> > in a single pair of quotes(") e.g.
>> >   char a[]="abcdef";     // string-2
>> >
>> > Please clear why string-1 is not showing syntax error
>> > and how it is same as string-2.
>
> Because string literals are concatenated before syntactic and
> semantic analysis.
>
>> The preprocessor will concatenate them.
>
> Nit: The compiler will concatenate them. Preprocessors are
> usually limited to translation phases 1 through 4. String
> concatenation is translation phase 6 [cf 5.1.1.2.]

And the reason for this apparently pointless thing is that it lets you
construct string literals at compile time:

#define NAME "Nick"
char a[] = "Hello " NAME " and welcome"

Combined with the "stringizing" feature and you can can do even more.
--
Online waterways route planner | http://canalplan.eu
Plan trips, see photos, check facilities | http://canalplan.org.uk


== 2 of 2 ==
Date: Mon, Apr 19 2010 11:56 pm
From: Nick Keighley


On 20 Apr, 07:42, Nick <3-nos...@temporary-address.org.uk> wrote:
> Peter Nilsson <ai...@acay.com.au> writes:
> > Ian Collins <ian-n...@hotmail.com> wrote:
> >> >     I was trying to understand some code and came across a
> >> > string literal definition as:
> >> > char a[]="abc""def";    // string-1
>
> >> >    I had seen eariler only string literal with characters
> >> > in a single pair of quotes(") e.g.
> >> >   char a[]="abcdef";     // string-2
>
> >> > Please clear why string-1 is not showing syntax error
> >> > and how it is same as string-2.
>
> > Because string literals are concatenated before syntactic and
> > semantic analysis.
>
> >> The preprocessor will concatenate them.
>
> > Nit: The compiler will concatenate them. Preprocessors are
> > usually limited to translation phases 1 through 4. String
> > concatenation is translation phase 6 [cf 5.1.1.2.]
>
> And the reason for this apparently pointless thing is that it lets you
> construct string literals at compile time:
>
> #define NAME "Nick"
> char a[] = "Hello " NAME " and welcome"
>
> Combined with the "stringizing" feature and you can can do even more.

and break up long strings over multiple lines


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

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