comp.lang.c - 25 new messages in 7 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+. - 10
messages, 6 authors
http://groups.google.com/group/comp.lang.c/t/5954dc70a43f9f8e?hl=en
* float point arithmetic a-a != 0.0 - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/9aebd187bdd10c51?hl=en
* ANNOUNCE: WinGDB - debugging with GDB under Visual Studio - 4 messages, 4
authors
http://groups.google.com/group/comp.lang.c/t/caa9b97bbee41cd4?hl=en
* Concerns Heathfield's and Seebach's behavior: please read - 4 messages, 4
authors
http://groups.google.com/group/comp.lang.c/t/cc475a35adc056e8?hl=en
* UTF-8 and wchar_t - 2 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/6e69f9f50e29243f?hl=en
* A Minor Problem With atoi() And Negative Numbers - 3 messages, 3 authors
http://groups.google.com/group/comp.lang.c/t/5218f6623a71b4c1?hl=en
* how to get out of double for loops? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/535cb24e8f02aec3?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 10 ==
Date: Mon, Mar 8 2010 1:48 pm
From: jacob navia
Jasen Betts a écrit :
> On 2010-03-07, Ian Collins <ian-news@hotmail.com> wrote:
>> Why hasn't the same thing happened with C?
>
> too much work for too little gain.
>
> C does not have templates, only macros, and using macros template
> functiuons longer than 5 lines are hard to maintain, and longer than
> 50 are impossible.
>
A container library doesn't need macros. You can use void * and
it works.
I have developed a container library using plain C, and I have
already:
o lists (single/double linked)
o flexible arrays
o bitstrings
o AVL trees
o Red/Black trees
and it is not finished yet.
--
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.
== 2 of 10 ==
Date: Mon, Mar 8 2010 1:48 pm
From: Ian Collins
ImpalerCore wrote:
> On Mar 7, 5:13 pm, Ian Collins <ian-n...@hotmail.com> wrote:
>> One interesting question is why, after over 30 years of use, there
>> hasn't appeared a widely accepted a general and extensible container
>> interface for C?
>>
>> The C++ STL appeared fairly early on in that language's evolution and
>> was rapidly and widely accepted by C++ developers. The widespread use
>> resulted in it being incorporated into the standard library in first
>> language standard.
>>
>> Why hasn't the same thing happened with C?
>
> That is a very good question. I think that you may have hinted at the
> problem already, "C++ STL appeared fairly early on".
>
> I imagine that the Stepanov and other people pursuing generic
> containers didn't think C could provide the right support. The fact
> that C++ standardization was fluid while he was working on his ideas
> certainly made for easier acceptance by that language. C++ at that
> time had much less inertia compared to C, and better language support
> for his ideas. The longer a feature (the two big ones are a standard
> container library, and concurrency) is not available in the
> development of a language's toolset, the more likely that the
> implementation of that feature will be fragmented across the
> architectures and the people who need it. I believe the fact that the
> STL came together in C++'s infancy led to more general acceptance as a
> whole. Delay the STL enough, maybe a couple of years, and I believe
> that C++ would have had the same problem, maybe.
>
> I may be completely off, but those are my current thoughts on the
> question.
I think you probably are on the right track (at least you have the same
thoughts as me!). Early adoption was the key. I guess the same applied
to the C standard library; most of it was in use on early Unix systems
and the standard simply standardised existing practice (see a lot of the
examples in the original K&R).
Along with early availability, there has to be a strong desire from
users to improve and grow a language. Drawing another comparison with
C++, compare the work going on with C++0x and C99. By the time C++0x is
ratified, there will probably be more (almost complete) implementations
of it than there are C99, over a decade after ratification. A large
part of the new standard library is already in widespread use. There
are also significant improvements to the core language, driven by a
desire to improve upon what we currently have. One of these is language
support for concurrency, so if the will is there, it's never too late!
<OT>
For anyone interested, http://www2.research.att.com/~bs/C++0xFAQ.html
gives an incite into motivations for the new C++ standard.
</OT>
--
Ian Collins
--
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.
== 3 of 10 ==
Date: Mon, Mar 8 2010 1:48 pm
From: Ian Collins
Malcolm McLean wrote:
> On 8 Mar, 08:59, Thomas Richter <t...@math.tu-berlin.de> wrote:
>> You still don't get it, don't you? I'm not a "C++ advocate". I'm a "use
>> the right tool for the job" advocate. That might be C, C++, java,
>> pyhton, bash, or whatever else is out in the field.
>>
> That sounds so sensible that no-one would ever disagree with it.
>
> The problem comes when the costs to using the tools are significant.
> Imagine a carpenter who has to walk from village to village picking up
> odd jobs. He'll take a hammer and a saw. A lathe and a drill would
> also be handy, but take too much and he's got to hire an assistant to
> carry the toolbag, which means that he'll have to bump up his charges
> considerably. Using a nail where ideally you'd put a screw might be
> the best solution.
Or he will buy a van and grow is business because ha can tackle a
broader range of jobs. He will do the job in less than half the time,
to the client pays less.
I like that analogy!
--
Ian Collins
--
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.
== 4 of 10 ==
Date: Mon, Mar 8 2010 1:49 pm
From: Ian Collins
Dag-Erling Smørgrav wrote:
> Nick Keighley <nick_keighley_nospam@hotmail.com> writes:
>> quite correct. This harping on about keywords is just silly. You can
>> write code that compiles with both and a C compiler and a C++
>> compiler. And it isn't that hard.
>
> From scratch, yes. Most existing C code will need modifications, such
> as casts for malloc() and renaming variables or functions called new and
> delete (which are the most common conflicts). The implicit "struct" /
> "class" will get you in trouble if you're in the habit of typedefing
> structs.
Why?
> You will also have to wrap headers for external C libraries in
> extern "C" { } if they aren't already. Older code may contain K&R-style
> function declarations and definitions (!prototypes), which won't work.
A good excuse to fix them!
--
Ian Collins
--
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 10 ==
Date: Mon, Mar 8 2010 1:08 pm
From: Flash Gordon
jacob navia wrote:
> Lorenzo Villari a écrit :
>> On Mon, 8 Mar 2010 02:59:32 -0600 (CST)
>> Thomas Richter <thor@math.tu-berlin.de> wrote:
>>
>>> You still don't get it, don't you? I'm not a "C++ advocate". I'm a
>>> "use the right tool for the job" advocate. That might be C, C++,
>>> java, pyhton, bash, or whatever else is out in the field. For complex
>>> algorithms on a desktop system, I wouldn't use C. Neither would I use
>>> C++ for a GUI-intensive problem, java is much better suited for that,
>>> nor would I write scripts in java, that's what I use python for.
>>
>> What does it means "GUI-intensive" and why should java be better at
>> solving these kinds of problems?
Doesn't it have some kind of graphics library as part of the standard?
Or did someone mis-lead me many years ago?
>> Excluding subjective aesthetic
>> consideration on the resulting GUIs, I think some operations
>> "could" (but I'm unaware of recent changes so I could be wrong) be a bit
>> slower than an analogous C or C++ counterpart. Of course if maximum
>> speed is not required that's ok. A slow menu is not that cool btw...
>
> For an example of a full C only program using advanced GUI features
> see the lcc-win debugger.
>
> The debugger+IDE+Project management+Editor+grep+diff+reformater+etc
> is just 800K (windows 32 bit).
>
> Only C allows you the speed AND power of direct GUI access with access
> to the low level debugging API.
No, if the API is available to C it is also available to C++.
Also, when writing a GUI I don't normally want to get under the hood by
accessing the GUI directly, I normally want to use a nice powerful
widget set that does a lot of the hard work for me.
--
Flash Gordon
== 6 of 10 ==
Date: Mon, Mar 8 2010 2:17 pm
From: jacob navia
Flash Gordon a �crit :
> jacob navia wrote:
>> Only C allows you the speed AND power of direct GUI access with access
>> to the low level debugging API.
>
> No, if the API is available to C it is also available to C++.
>
No. As you (may) know, you have to write
extern "C"
in C++
> Also, when writing a GUI I don't normally want to get under the hood by
> accessing the GUI directly, I normally want to use a nice powerful
> widget set that does a lot of the hard work for me.
That's a viewpoint. Another viewpoint (mine) is that experience has told me NOT to use any widget
set but use the API. This way, I have been able to run programs written under windows 16 bits
today under windows 64 bits.
== 7 of 10 ==
Date: Mon, Mar 8 2010 2:22 pm
From: Ian Collins
jacob navia wrote:
> Flash Gordon a �crit :
>> jacob navia wrote:
>>> Only C allows you the speed AND power of direct GUI access with access
>>> to the low level debugging API.
>>
>> No, if the API is available to C it is also available to C++.
>>
> No. As you (may) know, you have to write extern "C" in C++
Er, so? Wrap the header in extern "C" {..} and away you go.
--
Ian Collins
== 8 of 10 ==
Date: Mon, Mar 8 2010 2:23 pm
From: Keith Thompson
jacob navia <jacob@nospam.org> writes:
> Flash Gordon a écrit :
>> jacob navia wrote:
>>> Only C allows you the speed AND power of direct GUI access with access
>>> to the low level debugging API.
>>
>> No, if the API is available to C it is also available to C++.
>
>
> No. As you (may) know, you have to write
> extern "C"
> in C++
If you replaced "No" by "Yes", I'd agree. Yes, you have to write
extern "C"; that's *how* the API is available to C++.
I'm sure you didn't mean to imply that typing extern "C" is too
difficult, but I can't figure out what point you were making.
Can you clarify?
--
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"
== 9 of 10 ==
Date: Mon, Mar 8 2010 3:08 pm
From: jacob navia
Seebs a écrit :
>
> You know what's an awesome feature in a programming language? An "eval"
> operation, which interprets strings as code. Incredibly flexible and
> powerful.
>
> Do you think we should add eval() to C? I don't.
>
>> thomas: C is low level and nothing should be improved. It is low level
>> because it lacks A and B. Use C++ that has A and B.
>
> I do not think this is a fair representation of his argument.
>
Under lcc-win you can do:
typedef void (fnptr)(void);
fnptr fn;
fn = CompileString("int main(void)(printf("\hello\"); )");
fn();
and you get "hello"...
This is called a JIT (Just in Time Compiler). Lcc-win has a JIT version.
(snip advice)
>
> I believe his argument is that he does not feel that adding A and B would
> improve C. For instance, I don't think that adding operator overloading would
> improve C. I think it would make C worse. One of the things I like about
> C is the confidence that I know what it's doing. Operator overloading is
> a great fit for an OO language, where I expect objects to have internal state
> and define their own rules. It's a poor fit for a language where I
> expect operations to map very closely onto machine instructions.
>
> -s
You do operator overloading in c when you use an operator like
+ since the compiler will do all necessary conversions for you.
The only thing that operator overloading adds to the language is the possibility
for the USER to add itsb own numeric types. Besides, if you do not like that
feature, do not use it. The language stays the same otherwise.
And (you probably know that)
unsigned long a,b,c;
// ...
c = a+b;
This translates into a function call in some machines.
(Specially 16 bit machines).
--
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.
== 10 of 10 ==
Date: Mon, Mar 8 2010 3:29 pm
From: Richard Heathfield
bartc wrote:
> Richard Heathfield wrote:
<snip>
>> [...] To
>> define a synonym for an existing type, all you have to do is pretend
>> you're defining an object of that type, and stick typedef on the
>> front.
>
> This is a method I /have/ to use in order to write typedefs, because I
> do not find them intuitive.
Because I use this method for writing typedefs, I find them intuitive.
<snip>
>> Let's say you want a synonym for an array of ten pointers to
>> function taking const char * and returning int.
>
> You're assuming I know what const char * means (and so did I).
I thought that was a reasonable assumption.
> Cdecl tells
> me it's actually a pointer to const char (not const pointer to char).
Obviously the assumption was misplaced.
<snip>
> To summarise, to declare a variable x with such a type:
>
> typedef int func(const char *);
> typedef func arr[10];
> arr x;
Yes.
>
> Which is an alternative to writing (with some help from cdecl):
>
> int (*x[10])(const char *);
Yes.
> The typedefs at least turn it from impossible to possible, although in my
> scheme, it would just be:
>
> [10]*function(* const char)int x;
EEK!
<snip>
--
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: float point arithmetic a-a != 0.0
http://groups.google.com/group/comp.lang.c/t/9aebd187bdd10c51?hl=en
==============================================================================
== 1 of 1 ==
Date: Mon, Mar 8 2010 1:59 pm
From: Ed Prochak
On Mar 8, 9:25 am, Noob <r...@127.0.0.1> wrote:
> Sean wrote:
> > float point arithmetic a-a != 0.0
>
> You might find the following article somewhat relevant.
>
> What Every Computer Scientist Should Know About Floating-Point Arithmetichttp://docs.sun.com/source/806-3568/ncg_goldberg.html
>
> Regards.
One phrase to keep handy if looking for more information is:
applied numerical methods
HTH,
ed
==============================================================================
TOPIC: ANNOUNCE: WinGDB - debugging with GDB under Visual Studio
http://groups.google.com/group/comp.lang.c/t/caa9b97bbee41cd4?hl=en
==============================================================================
== 1 of 4 ==
Date: Mon, Mar 8 2010 2:04 pm
From: REH
On Mar 8, 3:46 pm, jacob navia <ja...@spamsink.net> wrote:
> Dominic WG a écrit :
>
> > Hello,
>
> > WinGDB is an extension for Visual Studio IDE allowing to use GDB
> > debugger. It can debug processes on remote machines running Linux (or
> > other Unix systems) through SSH connection, Windows programs compiled
> > under MinGW or Cygwin, and embedded ARM devices using OpenOCD.
>
> > Please visit our site:http://www.wingdb.com
>
> > Kind Regards,
> > WinGDB team
>
> This is incredible
>
> These guys are selling gdb (packed in a Visual Studio plug in) at 47.5
> euros per machine...
>
> Why would anyone want to use gdb after having bought Visual Studio with
> its great debugger is a mystery to me.
I think that's the point. Visual Studio has an awesome GUI debugger,
but it won't debug code built with other compilers, remote sessions,
embedded devices, etc. If they'd fully integrated GDB into VS, I'd buy
it. Existing frontends for GDB are horrible.
REH
== 2 of 4 ==
Date: Mon, Mar 8 2010 2:22 pm
From: pacman@kosh.dhis.org (Alan Curry)
In article <hn3no0$e5a$1@speranza.aioe.org>,
jacob navia <jacob@jspamsink.org> wrote:
|Dominic WG a �crit :
|> Hello,
|>
|> WinGDB is an extension for Visual Studio IDE allowing to use GDB
|> debugger. It can debug processes on remote machines running Linux (or
|> other Unix systems) through SSH connection, Windows programs compiled
|> under MinGW or Cygwin, and embedded ARM devices using OpenOCD.
|>
|> Please visit our site: http://[[spammerlinkremoved]]
|>
|> Kind Regards,
|> WinGDB team
|
|This is incredible
|
|These guys are selling gdb (packed in a Visual Studio plug in) at 47.5
|euros per machine...
This lousy googlegruper has been slow-motion multiposting (a.k.a. spamming)
its advertisement to every conceivably-related newsgroup over the past 2 or 3
days.
Don't buy products from spammers, especially software, how do you knowi t's
not backdoored so they can spam from your machine when you run it?
--
Alan Curry
== 3 of 4 ==
Date: Mon, Mar 8 2010 2:28 pm
From: Richard
REH <spamjunk@stny.rr.com> writes:
> On Mar 8, 3:46 pm, jacob navia <ja...@spamsink.net> wrote:
>> Dominic WG a écrit :
>>
>> > Hello,
>>
>> > WinGDB is an extension for Visual Studio IDE allowing to use GDB
>> > debugger. It can debug processes on remote machines running Linux (or
>> > other Unix systems) through SSH connection, Windows programs compiled
>> > under MinGW or Cygwin, and embedded ARM devices using OpenOCD.
>>
>> > Please visit our site:http://www.wingdb.com
>>
>> > Kind Regards,
>> > WinGDB team
>>
>> This is incredible
>>
>> These guys are selling gdb (packed in a Visual Studio plug in) at 47.5
>> euros per machine...
>>
>> Why would anyone want to use gdb after having bought Visual Studio with
>> its great debugger is a mystery to me.
>
> I think that's the point. Visual Studio has an awesome GUI debugger,
> but it won't debug code built with other compilers, remote sessions,
> embedded devices, etc. If they'd fully integrated GDB into VS, I'd buy
> it. Existing frontends for GDB are horrible.
>
> REH
You are too kind. They look they have been cobbled together by an idiot.
--
"Avoid hyperbole at all costs, its the most destructive argument on
the planet" - Mark McIntyre in comp.lang.c
== 4 of 4 ==
Date: Mon, Mar 8 2010 3:18 pm
From: Phred Phungus
REH wrote:
> On Mar 8, 3:46 pm, jacob navia <ja...@spamsink.net> wrote:
>> Dominic WG a écrit :
>>
>>> Hello,
>>> WinGDB is an extension for Visual Studio IDE allowing to use GDB
>>> debugger. It can debug processes on remote machines running Linux (or
>>> other Unix systems) through SSH connection, Windows programs compiled
>>> under MinGW or Cygwin, and embedded ARM devices using OpenOCD.
>>> Please visit our site:http://www.wingdb.com
>>> Kind Regards,
>>> WinGDB team
>> This is incredible
>>
>> These guys are selling gdb (packed in a Visual Studio plug in) at 47.5
>> euros per machine...
>>
>> Why would anyone want to use gdb after having bought Visual Studio with
>> its great debugger is a mystery to me.
>
> I think that's the point. Visual Studio has an awesome GUI debugger,
> but it won't debug code built with other compilers, remote sessions,
> embedded devices, etc. If they'd fully integrated GDB into VS, I'd buy
> it. Existing frontends for GDB are horrible.
>
> REH
That's where I'm looking at this. Gdb is a hardship compared to the
visual debuggers I used to have when I used M$.
I don't think I'd give these people any money, tho.
--
fred
==============================================================================
TOPIC: Concerns Heathfield's and Seebach's behavior: please read
http://groups.google.com/group/comp.lang.c/t/cc475a35adc056e8?hl=en
==============================================================================
== 1 of 4 ==
Date: Mon, Mar 8 2010 2:21 pm
From: "Robbie Hatley"
"spinoza1111" spews:
> (snip reams of petty bickering and legal threats)
Oh, gawd. I come to comp.lang.c to see what's up in the world
of C, and I see this stuff. Waaaaaaaaaaaaaaaaaaaaaaaaaaaaay
off-topic for this group. If you want to make behavior
complaints and/or legal threats, do it by email, mail, or
telephone; technical Usenet groups are *NOT* the place for it.
The rest of us are offended at being hijacked in this way.
--
Cheers,
Robbie Hatley
lonewolf at well dot com
www dot well dot com slant tilde lonewolf slant
== 2 of 4 ==
Date: Mon, Mar 8 2010 2:24 pm
From: John Bode
On Feb 28, 10:45 pm, spinoza1111 <spinoza1...@yahoo.com> wrote:
> However, it's plain that I'm a piker when it comes to being offensive.
> See Heathfield's post in the thread Edward Nilges' Lie.
>
You mean the thread that *you* started titled "Richard Heathfield's
Lie" (http://groups.google.com/group/comp.lang.c/msg/
fcf1798c91f4fdc4), which was retitled by Colonel Harlan Sanders (who
is not Richard Heathfield) as "Edward Nilges' Lie" (http://
groups.google.com/group/comp.lang.c/msg/771ba359d9a2afdb). You
started this particular fight. You threw the first punch. Now you're
crying that people are being mean to you.
This is pathethic. You are pathetic.
> Because he cannot code properly and doesn't know computer science, and
> is an uncultivated boor who works as a temp, he thinks it's cute to
> forge letters said to be from me, a violation of the law.
>
Actually, he said (http://groups.google.com/group/comp.lang.c/msg/
ef86f0b0c8aba46c):
"Actually, I *did* eventually get a letter from a lawyer. I have no
idea
whether it's Mr Nilges's lawyer, but I suppose it's not impossible."
Yes, Heathfield is openly mocking you. Frankly, you deserve it at
this point. I still think you need professional help, but that's less
out of concern for you than for random strangers you'll run into in
the future.
> Julienne and blm, you are enablers, because you don't complain to him
> about his behavior: like many women in this type of situation, you're
> a little dazzled by the thug and his transgressions; perhaps an
> atavistic part of you is not a little excited by blood, metaphorical
> or otherwise.
Oh, yeah, that kind of attitude is going to win you *loads* of support
from the women.
> I am using this newsgroup as intended and even Seebach
> has conceded that these threads have been useful and productive. I
> start them, whereas Heathfield and Seebach endeavor to destroy them
> because they're not qualified to participate on a level with people
> like Navia and Willem, let alone me (100% bug rate in strlen, absurd
> linked list, heap a DOS term, is not a programmer per se, etc).
>
> Julienne, blm, and Malcolm, I shall not participate in these newsgroup
> until you find it in yourselves to complain to Heathfield and Seebach
> in the thread Edward Nilges' lie where Heathfield posts a letter he
> says is from my lawyer: this was a criminal act on his part. I will
> not read or post to these newsgroups, and you people can return to
> your regularly scheduled programming.
>
Is that a promise? Can we hold you to that?
> You may email me at spinoza1...@yahoo.com. But what I would most
> appreciate is copies of your post or emails to Seebach and Heathfield,
> asking them to desist. This type of behavior is the norm in groups of
> fair and decent people.
>
> Otherwise, I am wasting my time here.
>
> Malcolm, Julienne, blm: unless I hear from you by Monday March 8,
> under advice of my counsel, genuine letters are going this week to
> Seebach's employer and my publisher (who is also Seebach's publisher)
> concerning his behavior. In addition, a letter is going to SAMS
> concerning Heathfield.
I look forward to the results.
== 3 of 4 ==
Date: Mon, Mar 8 2010 2:25 pm
From: Keith Thompson
"Robbie Hatley" <see.my.signature@for.my.contact.info> writes:
> "spinoza1111" spews:
>> (snip reams of petty bickering and legal threats)
>
> Oh, gawd. I come to comp.lang.c to see what's up in the world
> of C, and I see this stuff. Waaaaaaaaaaaaaaaaaaaaaaaaaaaaay
> off-topic for this group. If you want to make behavior
> complaints and/or legal threats, do it by email, mail, or
> telephone; technical Usenet groups are *NOT* the place for it.
> The rest of us are offended at being hijacked in this way.
Robbie, we've been telling him this for months. It never works.
(Ignoring him might work, but only if we can all bring ourselves
to do it.)
I've found that a killfile makes this newsgroup a much more
pleasant place.
--
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"
== 4 of 4 ==
Date: Mon, Mar 8 2010 3:32 pm
From: Richard Heathfield
Dann Corbit wrote:
> In article <RZidnbAdVJOhhw_WnZ2dnUVZ8sRi4p2d@bt.com>,
> rjh@see.sig.invalid says...
>> Chris M. Thomasson wrote:
>> <snip>
>>
>>> IMVHO, Women have free will.
>> Men, on the other hand...
>
> All men are mortal.
> All women are mortal.
> Therefore, all men are women.[*]
> Clearly then, all men have free will also.
>
> [*] Yes, it is a very bad math joke.
I think you'd have to improve it by several orders of magnitude to get
it anywhere near the point where it deserves the accolade of "very bad".
--
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: UTF-8 and wchar_t
http://groups.google.com/group/comp.lang.c/t/6e69f9f50e29243f?hl=en
==============================================================================
== 1 of 2 ==
Date: Mon, Mar 8 2010 3:14 pm
From: Michal Nazarewicz
"christian.bau" <christian.bau@cbau.wanadoo.co.uk> writes:
> That code isn't filtering out 3 and 4 byte sequences that could be
> represented in a shorter way,
It's not really an issue for me (I think). The string is not
interpreted in any way so security is not a concern. After converting
to a string of wide characters it's printed to standard output using
wctomb() so everything should be fine.
Still, I'll add a comment pointing that out.
> and it doesn't filter values > 0x10ffff if WCHAR_MAX is large (like 32
> bit).
It does that by treating bytes >= 0xF5 in the input UTF-8 string as
invalid. Refer to
<URL:http://en.wikipedia.org/wiki/UTF-8#Description>.
> And I'm not quite sure why you compare against WCHAR_MAX - WCHAR_MIN.
wchar_t can be signed so (WCHAR_MAX - WCHAR_MIN + 1) is the number of
values it can represent therefore if value <= (WCHAR_MAX - WCHAR_MIN) it
can be represented in wchar_t.
--
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +--<mina86*tlen.pl>--<jid:mina86*jabber.org>--ooO--(_)--Ooo--
== 2 of 2 ==
Date: Mon, Mar 8 2010 3:15 pm
From: Michal Nazarewicz
> In article <87sk8cic2w.fsf@erwin.mina86.com>,
> Michal Nazarewicz <mina86@tlen.pl> writes:
>> static void _out(wchar_t ch) {
>> char buf[MB_CUR_MAX];
>> int ret;
>>
>> retry:
>> ret = wctomb(buf, ch);
>> if (ret > 0) {
>> printf("%.*s", ret, buf);
>> } else if (ch != L'?') {
>> ch = L'?';
>> goto retry;
>> } else {
>> putchar('?');
>> }
>> }
lacos@ludens.elte.hu (Ersek, Laszlo) writes:
> L'?' can always be represented in the execution character set. [...]
> Hence, the middle section and the label are superfluous.
It's my first time using wchar_t so I wasn't quite sure how things work
in "wide world". Thanks for pointing that out.
--
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +--<mina86*tlen.pl>--<jid:mina86*jabber.org>--ooO--(_)--Ooo--
==============================================================================
TOPIC: A Minor Problem With atoi() And Negative Numbers
http://groups.google.com/group/comp.lang.c/t/5218f6623a71b4c1?hl=en
==============================================================================
== 1 of 3 ==
Date: Mon, Mar 8 2010 3:22 pm
From: Marcelo De Brito
Hi!
Thank you so much for your replies! :-)
I would like to know how a program would take a string of chars as its
input through command line. For example, let's say we have simple
program that takes a string of chars and returns us the length of it.
See:
./my_program my dromedrario is cool
How to implement that? What should I do to pass the string "my
dromedrario is cool" as the program input? What functions should I use
to implement that?
Please, avoid BIFFisms ( http://bit.ly/cEjn3K ) as replies! :-)
Best Regards!
Marcelo
== 2 of 3 ==
Date: Mon, Mar 8 2010 3:33 pm
From: Dann Corbit
In article <ce0fbca9-4bb7-4e3e-b560-
f40a238e259a@x22g2000yqx.googlegroups.com>, nosophorus@gmail.com says...
>
> Hi!
>
> Thank you so much for your replies! :-)
>
> I would like to know how a program would take a string of chars as its
> input through command line. For example, let's say we have simple
> program that takes a string of chars and returns us the length of it.
> See:
>
> ./my_program my dromedrario is cool
int main(int argc, char **argv)
{
if (argc > 1)
{
/* Examine command line arguments here... */
/*
Note that we will not be able to tell the difference between:
my dromedrario is cool
and
my dromedrario is cool
unless we use quoted arguments like this:
"my dromedrario is cool"
and
"my dromedrario is cool"
*/
}
return 0;
}
> How to implement that? What should I do to pass the string "my
> dromedrario is cool" as the program input? What functions should I use
> to implement that?
>
> Please, avoid BIFFisms ( http://bit.ly/cEjn3K ) as replies! :-)
How about Spaceman Spiffisms?
Now where did I put my Atomic Napalm Neutralizer?
== 3 of 3 ==
Date: Mon, Mar 8 2010 3:52 pm
From: ike@localhost.claranet.nl (Ike Naar)
In article <ce0fbca9-4bb7-4e3e-b560-f40a238e259a@x22g2000yqx.googlegroups.com>,
Marcelo De Brito <nosophorus@gmail.com> wrote:
>I would like to know how a program would take a string of chars as its
>input through command line. For example, let's say we have simple
>program that takes a string of chars and returns us the length of it.
>See:
>
>./my_program my dromedrario is cool
>
>How to implement that? What should I do to pass the string "my
>dromedrario is cool" as the program input? What functions should I use
>to implement that?
>
$ cat a.c
#include <stdio.h>
int main(int argc, char **argv)
{
if (argc==2) puts(argv[1]);
return 0;
}
$ cc a.c
$ ./a.out "Please, avoid BIFFisms ( http://bit.ly/cEjn3K ) as replies! :-)"
Please, avoid BIFFisms ( http://bit.ly/cEjn3K ) as replies! :-)
==============================================================================
TOPIC: how to get out of double for loops?
http://groups.google.com/group/comp.lang.c/t/535cb24e8f02aec3?hl=en
==============================================================================
== 1 of 1 ==
Date: Mon, Mar 8 2010 3:34 pm
From: Richard Heathfield
Flash Gordon wrote:
> Eric Sosman wrote:
>> On 3/8/2010 11:22 AM, lawrence.jones@siemens.com wrote:
>>> Ben Bacarisse<ben.usenet@bsb.me.uk> wrote:
>>>>
>>>> Eric's did register on my humour meter but Lawrence is talking a load
>>>> of mallocs.
>>>
>>> Hey, let's not cast aspersions.
>>
>> ... nor make it an automatic response to dish out this
>> type of static.
>
> if we could break out of this loop it would be good, but we can't while
> the coding standards forbid it.
Oi! Can't you take an 'int?
--
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
==============================================================================
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