comp.lang.c++
http://groups.google.com/group/comp.lang.c++?hl=en
comp.lang.c++@googlegroups.com
Today's topics:
* A function returning an array - 3 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/416a46975f0a408f?hl=en
* And the mythical man month rears its ugly head again - 11 messages, 5
authors
http://groups.google.com/group/comp.lang.c++/t/14de696de81237ff?hl=en
* static function in named namespace - 4 messages, 3 authors
http://groups.google.com/group/comp.lang.c++/t/97c149400be76b3b?hl=en
* Can straight line est fit with error measure be made in single pass? - 1
messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/9d315080851a97ca?hl=en
* String class and the use of char*/const char* - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/deff4cb6c8ab6f38?hl=en
* Request for build feedback - 5 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/dc0fd05b60e1fac5?hl=en
* Integer arithmetic when overflow exists - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/817dc36a142b4ac5?hl=en
==============================================================================
TOPIC: A function returning an array
http://groups.google.com/group/comp.lang.c++/t/416a46975f0a408f?hl=en
==============================================================================
== 1 of 3 ==
Date: Fri, Oct 25 2013 1:48 pm
From: Jorgen Grahn
On Wed, 2013-10-23, axcytz@gmail.com wrote:
...
> Thanks for your help firstly. What I tried is:
>
> Function(int myArray[], int UpdateArray[])
> {
> for(int t=0; t < NumElement; t++)
> {
> UpdateArray[t] = myArray[t];
> }
>
> swap(UpdateArray[0], UpdateArray[1]);
>
> return UpdateArray;
> }
What you're doing here would, in C++, be done using iterators:
template<class It>
void Function(It src, size_t n, It dest)
{
std::copy(src, src+n, dest);
assert(n>1);
std::swap(*dest, *dest+1);
}
But that's rather far away from the concept of "returning an array".
You're not returning anything; you are copying. Have you been working
in Java a lot?
If you want to return an object, see earlier suggestions.
> Something like this. Is the syntax correct?
Don't you have a C++ compiler? It's better at catching syntax errors
than we are. It's part of its job.
/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
== 2 of 3 ==
Date: Fri, Oct 25 2013 2:30 pm
From: Jorgen Grahn
On Fri, 2013-10-25, Jorgen Grahn wrote:
...
> What you're doing here would, in C++, be done using iterators:
>
> template<class It>
> void Function(It src, size_t n, It dest)
> {
> std::copy(src, src+n, dest);
> assert(n>1);
> std::swap(*dest, *dest+1);
> }
I suppose that should be *(dest+1); it was just an untested sketch.
/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
== 3 of 3 ==
Date: Fri, Oct 25 2013 3:21 pm
From: Ian Collins
James Kanze wrote:
> On Wednesday, 23 October 2013 05:15:45 UTC+1, Ian Collins wrote:
>> axcytz@gmail.com wrote:
>> Please clean up the mess that awful google interface makes of your quotes!
>>> Thanks for your help firstly. What I tried is:
>
>>> Function(int myArray[], int UpdateArray[])
>>> {
>>> for(int t=0; t < NumElement; t++)
>>> {
>>> UpdateArray[t] = myArray[t];
>>> }
>>> swap(UpdateArray[0], UpdateArray[1]);
>>> return UpdateArray;
>>> }
>
>>> Something like this. Is the syntax correct? Can I just say
>>> return UpdateArray?
>
>> No, you can't return an array.
>
> But UpdateArray isn't an array.
Good spot! On the ball as always.
--
Ian Collins
==============================================================================
TOPIC: And the mythical man month rears its ugly head again
http://groups.google.com/group/comp.lang.c++/t/14de696de81237ff?hl=en
==============================================================================
== 1 of 11 ==
Date: Fri, Oct 25 2013 3:55 pm
From: woodbrian77@gmail.com
On Friday, October 25, 2013 10:13:31 AM UTC-5, Bo Persson wrote:
>
> The problem here is that he probably voted for the minority that
> believes health care for the population is a waste of money and can't
> accept that the administration proposing that actually was re-elected.
One reason I'm opposed to Obamacare is people should be
free to associate with those they choose as far as
health care. That may be the only way to get people
to take responsibility for themselves. In other words,
if you smoke, use marijuana or other illegal drugs,
are obese, ... sorry, but I don't want to join you
in a health care pool. A pool of responsible people
can show others that it's possible to get reasonable
prices on health care, but you have to be accountable.
The Republican majority in the House was also re-elected.
== 2 of 11 ==
Date: Fri, Oct 25 2013 5:33 pm
From: Geoff
On Fri, 25 Oct 2013 21:12:58 +0200, David Brown
<david.brown@removethis.hesbynett.no> wrote:
>On 25/10/13 15:23, Geoff wrote:
>> On Fri, 25 Oct 2013 09:05:23 +0200, David Brown
>> <david@westcontrol.removethisbit.com> wrote:
>>
>>> Wait a minute, you /do/ live in a democracy.
>>
>> No, I don't. It's a representative republic, there's a difference.
>>
>> The Republic of the United States of America was renamed "democracy"
>> during the Roosevelt administration.
>>
>> The problem at the moment is that the idiots who vote are appointing
>> the idiots who desire wealth and power and those idiots are creating
>> 10,000 page laws that they don't read and can't understand before they
>> vote them into law.
>>
>
>I actually know all this - my post was exaggerated. The biggest problem
>with letting (almost) anybody vote about politics is that almost nobody
>is qualified to make good judgements about politics (whether this means
>a representative democracy where voters must pick suitable politicians,
>or a direct democracy where voters make the political decisions themselves).
>
That voters are unqualified to make those decisions, we agree
completely. Exacerbated by the fact that politicians make promises
they have no intention of keeping, just to get those unqualified
votes.
>The general point remains, however - the politics and government in the
>USA is strongly influenced by the voters, and the citizens have a
>responsibility for the government. If enough people feel strongly
>enough, they should be able to make changes.
>
The problem begins when Congress feels they must actually do something
like write bills and pass them. Americans like gridlock. When the
executive and legislative branches are of opposite parties, everything
is fine. If congress runs rampant, the president can veto. It's only
when we elected Obama and had a Democrat-led Senate that we ran into
problems and the ACA was passed. Clinton couldn't get it passed while
Republicans led during his terms and Reid-Pelosi couldn't get it past
Bush's veto.
>I find it ironic that the people (in the western world) who seem to
>complain most about their government, especially the federal government,
>are Americans - yet these are the same people who are most convinced
>that they have the best and most democratic political system.
>
Americans have been complaining about their government since it was
founded, it's part of the culture. Go read "John Adams" by David
McCullough for some insights. Every one of the founders could find
something wrong with the way the others ran their presidencies. About
the only president in history who was universally liked was Washington
and he achieved that by serving his two terms and retiring from public
life.
>In Europe, most people think their governments do a reasonable job most
>of the time. When they think they are doing too badly, they vote in
>someone else at the next election and the politics change (not
>everything, and not overnight, but things do change).
In some ways a parliamentary process is superior to the process we
have in the states. Only a maximum of 1/3 of the house can be turned
out in a single election so for a complete turn-over it takes 6 years.
Senators are even harder to get rid of, they prefer to die in office
or go until the bitter end like Ted Kennedy. The problem is when the
voters seem to think having these fossils in office is a good thing.
== 3 of 11 ==
Date: Fri, Oct 25 2013 5:47 pm
From: Geoff
On Fri, 25 Oct 2013 17:13:31 +0200, Bo Persson <bop@gmb.dk> wrote:
>
>The problem here is that he probably voted for the minority that
>believes health care for the population is a waste of money and can't
>accept that the administration proposing that actually was re-elected.
>
>Democracy is only good when your own side wins?
I voted for Obama because McCain proved himself insane by choosing
Palin as a running mate. I prefer my presidents crafty and sane. I
also would be in favor of single-payer but Europe and Canada have
demonstrated that you can't have single-payer without rationing and
lack of availability.
I had an ER experience in 2009. Four days in hospital. Net result, a
bill for $80,000+ from the hospital. Net paid by private insurance
carrier by contract $17,700. Net co-pay to me $890. I don't know where
the rest of it disappeared into. Never heard another peep from anyone.
In 2002 I was in England and came down with otitus. This is a problem
when your a yank and your not on the national healthcare plan, or is
it? Have the local guy take you to the clinic and explain your
situation, pay twenty pounds to the doctor for the exam and
prescription, stop at the chemist on the way home, another 17 pounds
for medicine and were all back at the pub for bangers and mash.
Here's what the future holds for America: Fewer doctors, fewer
hospitals, lower quality care, longer wait times for surgeries,
problems with approval for treatments, higher costs all around.
== 4 of 11 ==
Date: Fri, Oct 25 2013 5:49 pm
From: Geoff
On Fri, 25 Oct 2013 15:55:04 -0700 (PDT), woodbrian77@gmail.com wrote:
>One reason I'm opposed to Obamacare is people should be
>free to associate with those they choose as far as
>health care.
The fundamental problem with national health care is the coercion. You
will be fined or harassed until you join the lemmings.
== 5 of 11 ==
Date: Fri, Oct 25 2013 6:24 pm
From: Ian Collins
Geoff wrote:
>
> Here's what the future holds for America: Fewer doctors, fewer
> hospitals, lower quality care, longer wait times for surgeries,
> problems with approval for treatments, higher costs all around.
Maybe they'll migrate down here.
Those of us in civilised parts of the world where universal healthcare
is a given always enjoy a hearty chuckle at our American friends
getting to a lather over what we take for granted. Here universal
healthcare isn't an issue, it just is!
Now back to some C++...
--
Ian Collins
== 6 of 11 ==
Date: Fri, Oct 25 2013 7:13 pm
From: woodbrian77@gmail.com
On Friday, October 25, 2013 7:33:02 PM UTC-5, Geoff wrote:
> In some ways a parliamentary process is superior to the process we
> have in the states. Only a maximum of 1/3 of the house can be turned
> out in a single election so for a complete turn-over it takes 6 years.
Every seat in the House is up for election every 2 years.
== 7 of 11 ==
Date: Sat, Oct 26 2013 12:35 am
From: Bo Persson
Geoff skrev 2013-10-26 02:49:
> On Fri, 25 Oct 2013 15:55:04 -0700 (PDT), woodbrian77@gmail.com wrote:
>
>> One reason I'm opposed to Obamacare is people should be
>> free to associate with those they choose as far as
>> health care.
>
> The fundamental problem with national health care is the coercion. You
> will be fined or harassed until you join the lemmings.
>
Yeah, that's the point - everyone is covered.
The argument that some of you could get better care if others get
nothing doesn't really bite on non-Americans.
Bo Persson
== 8 of 11 ==
Date: Sat, Oct 26 2013 1:01 am
From: Geoff
On Sat, 26 Oct 2013 09:35:47 +0200, Bo Persson <bop@gmb.dk> wrote:
>Geoff skrev 2013-10-26 02:49:
>> On Fri, 25 Oct 2013 15:55:04 -0700 (PDT), woodbrian77@gmail.com wrote:
>>
>>> One reason I'm opposed to Obamacare is people should be
>>> free to associate with those they choose as far as
>>> health care.
>>
>> The fundamental problem with national health care is the coercion. You
>> will be fined or harassed until you join the lemmings.
>>
>
>Yeah, that's the point - everyone is covered.
>
>The argument that some of you could get better care if others get
>nothing doesn't really bite on non-Americans.
>
>
Actually, those others don't get "nothing". They get the same
treatment now as they would under Obamacare. No hospital refuses care
based on ability to pay. If you walk into ER and need surgery, you get
it, then and there if necessary. The hospitals make up for the lost
revenue by increasing the charges for those with insurance.
Under the new plan, those who cannot afford to pay the premiums will
be subsidized, whose who can pay more will be paying larger premiums
up front. Socialism is complete, redistribution is done by the central
government and the nanny state is in charge, like it or not.
Why should there be a requirement to "buy in" at all? Simply use the
money collected by income taxes to pay for it all.
== 9 of 11 ==
Date: Sat, Oct 26 2013 10:16 am
From: woodbrian77@gmail.com
On Saturday, October 26, 2013 2:35:47 AM UTC-5, Bo Persson wrote:
>
> Yeah, that's the point - everyone is covered.
>
> The argument that some of you could get better care if others get
> nothing doesn't really bite on non-Americans.
>
As I see it this is a little bit of Obama's record:
Number of people on food stamps is up 12 million
Record poverty
Debt to GDP ratio has increased
He has sucked in so many ways. I don't trust him
and wouldn't vote for him if he were running for
dog catcher.
== 10 of 11 ==
Date: Sat, Oct 26 2013 11:08 am
From: "brad"
"Geoff" <geoff@invalid.invalid> wrote in message
news:chsm699pl5mmh9bl9n2hqepqkqhn329mio@4ax.com...
> On Sat, 26 Oct 2013 09:35:47 +0200, Bo Persson <bop@gmb.dk> wrote:
>
>>Geoff skrev 2013-10-26 02:49:
>>> On Fri, 25 Oct 2013 15:55:04 -0700 (PDT), woodbrian77@gmail.com wrote:
>>>
>>>> One reason I'm opposed to Obamacare is people should be
>>>> free to associate with those they choose as far as
>>>> health care.
>>>
>>> The fundamental problem with national health care is the coercion. You
>>> will be fined or harassed until you join the lemmings.
>>>
>>
>>Yeah, that's the point - everyone is covered.
>>
>>The argument that some of you could get better care if others get
>>nothing doesn't really bite on non-Americans.
>>
>>
>
> Actually, those others don't get "nothing". They get the same
> treatment now as they would under Obamacare. No hospital refuses care
> based on ability to pay. If you walk into ER and need surgery, you get
> it, then and there if necessary. The hospitals make up for the lost
> revenue by increasing the charges for those with insurance.
>
> Under the new plan, those who cannot afford to pay the premiums will
> be subsidized, whose who can pay more will be paying larger premiums
> up front. Socialism is complete, redistribution is done by the central
> government and the nanny state is in charge, like it or not.
>
> Why should there be a requirement to "buy in" at all? Simply use the
> money collected by income taxes to pay for it all.
The people who are really getting screwed over by this are the young people.
The law say that the insurance rate for a 64 year old, obese, alcoholic can
be no more than three times the rate for a fit 21 year old with a healthy
life style. The number 3 was arrived at, mostly, by a bunch of guys who
went to law school but barely practiced law, not actuaries. Except for when
I was in the army I never went to a doctor even once until I was in my
fifties. Many years ago, health care was 10% of the GNP, I am sure the
proportion has grown a lot since then. Of course, much of that 10% already
came from the government in the form of Medicaid and Medicare, now the young
can, and will, supplement that source.
The young are also being screwed by the debt thing. Someday, the Chinese
are going to want actual money, not a new IOU to replace the current one.
Who is going to live through that inflationary period? Same guys.
== 11 of 11 ==
Date: Sat, Oct 26 2013 9:08 pm
From: Geoff
On Sat, 26 Oct 2013 13:08:44 -0500, "brad" <noise@comcast.net> wrote:
>
>"Geoff" <geoff@invalid.invalid> wrote in message
>news:chsm699pl5mmh9bl9n2hqepqkqhn329mio@4ax.com...
>> On Sat, 26 Oct 2013 09:35:47 +0200, Bo Persson <bop@gmb.dk> wrote:
>>
>>>Geoff skrev 2013-10-26 02:49:
>>>> On Fri, 25 Oct 2013 15:55:04 -0700 (PDT), woodbrian77@gmail.com wrote:
>>>>
>>>>> One reason I'm opposed to Obamacare is people should be
>>>>> free to associate with those they choose as far as
>>>>> health care.
>>>>
>>>> The fundamental problem with national health care is the coercion. You
>>>> will be fined or harassed until you join the lemmings.
>>>>
>>>
>>>Yeah, that's the point - everyone is covered.
>>>
>>>The argument that some of you could get better care if others get
>>>nothing doesn't really bite on non-Americans.
>>>
>>>
>>
>> Actually, those others don't get "nothing". They get the same
>> treatment now as they would under Obamacare. No hospital refuses care
>> based on ability to pay. If you walk into ER and need surgery, you get
>> it, then and there if necessary. The hospitals make up for the lost
>> revenue by increasing the charges for those with insurance.
>>
>> Under the new plan, those who cannot afford to pay the premiums will
>> be subsidized, whose who can pay more will be paying larger premiums
>> up front. Socialism is complete, redistribution is done by the central
>> government and the nanny state is in charge, like it or not.
>>
>> Why should there be a requirement to "buy in" at all? Simply use the
>> money collected by income taxes to pay for it all.
>
>The people who are really getting screwed over by this are the young people.
>The law say that the insurance rate for a 64 year old, obese, alcoholic can
>be no more than three times the rate for a fit 21 year old with a healthy
>life style. The number 3 was arrived at, mostly, by a bunch of guys who
>went to law school but barely practiced law, not actuaries. Except for when
>I was in the army I never went to a doctor even once until I was in my
>fifties. Many years ago, health care was 10% of the GNP, I am sure the
>proportion has grown a lot since then. Of course, much of that 10% already
>came from the government in the form of Medicaid and Medicare, now the young
>can, and will, supplement that source.
>
>The young are also being screwed by the debt thing. Someday, the Chinese
>are going to want actual money, not a new IOU to replace the current one.
>Who is going to live through that inflationary period? Same guys.
>
Yep, same here. In retrospect I would have used doctors more. When I
was 24 I was paying premiums for services I wasn't using. They count
on that. But I was the young buck back then, paying for the older
guys' retirements and pensions and now I have to fund my own with
401(k) and IRA money and there's no pension fund to rely on because
they liquidated or stole it all. Now I'm 59 and seeing a doctor every
two months to be sure the 6 medications I'm taking for heart disease
aren't killing my liver.
It always sucks to be young and penniless and paying someone else's
debt. Then it sucks to be old and tired and paying someone else's
debt. Then you die and they collect all your wealth and pay someone
else's debt.
==============================================================================
TOPIC: static function in named namespace
http://groups.google.com/group/comp.lang.c++/t/97c149400be76b3b?hl=en
==============================================================================
== 1 of 4 ==
Date: Sat, Oct 26 2013 5:42 am
From: Tobias Müller
Jorgen Grahn <grahn+nntp@snipabacken.se> wrote:
> On Wed, 2013-10-23, Tobias Müller wrote:
>> Jorgen Grahn <grahn+nntp@snipabacken.se> wrote:
>>
>> [...]
>>
>>> I don't have any
>>> major problems with your way, but I don't want most of my code to be
>>> indented.
>>
>> I don't indent namespaces anyway. Usually I don't have more than one
>> namespace in a file so I don't see any advantage in it.
>
> Yeah, that was something I considered doing for a while. In the end
> it boiled down to "I don't want others to have to fight their editor
> about the indentation" and "I don't want to learn how to train Emacs
> not to indent namespaces".
In my experience this is only a problem when inserting something at the
very beginning of the namespace. At least Visual Studio only considers the
local context when indenting.
Except when you autoformat the whole file of course, but I almost never do
that.
> (On the other hand I'm not consistent: Emacs wants to indent 'extern
> "C"' blocks and that's clearly crazy from a C perspective.)
You mean because of the usual #ifdef __cplusplus guards?
Conditional compilation like that makes "correct" indenting impossible
anyway.
Tobi
== 2 of 4 ==
Date: Sat, Oct 26 2013 9:00 am
From: Jorgen Grahn
On Sat, 2013-10-26, Tobias Müller wrote:
> Jorgen Grahn <grahn+nntp@snipabacken.se> wrote:
>> On Wed, 2013-10-23, Tobias Müller wrote:
>>> Jorgen Grahn <grahn+nntp@snipabacken.se> wrote:
>>>
>>> [...]
>>>
>>>> I don't have any
>>>> major problems with your way, but I don't want most of my code to be
>>>> indented.
>>>
>>> I don't indent namespaces anyway. Usually I don't have more than one
>>> namespace in a file so I don't see any advantage in it.
>>
>> Yeah, that was something I considered doing for a while. In the end
>> it boiled down to "I don't want others to have to fight their editor
>> about the indentation" and "I don't want to learn how to train Emacs
>> not to indent namespaces".
>
> In my experience this is only a problem when inserting something at the
> very beginning of the namespace. At least Visual Studio only considers the
> local context when indenting.
> Except when you autoformat the whole file of course, but I almost never do
> that.
>
>> (On the other hand I'm not consistent: Emacs wants to indent 'extern
>> "C"' blocks and that's clearly crazy from a C perspective.)
>
> You mean because of the usual #ifdef __cplusplus guards?
> Conditional compilation like that makes "correct" indenting impossible
> anyway.
I meant it's "clearly crazy" because you want to distract C users of
your header file as little as possible, so they don't petition you to
drop C++ compatibility ...
At least with Emacs, I don't think the indenting logic looks at
#ifdefs at all.
/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
== 3 of 4 ==
Date: Sun, Oct 27 2013 1:57 am
From: Rupert Swarbrick
Jorgen Grahn <grahn+nntp@snipabacken.se> writes:
> At least with Emacs, I don't think the indenting logic looks at
> #ifdefs at all.
The curly bracket in
extern "C" {
makes Emacs indent the following line. But if you manually put the first
declaration at column zero, Emacs "does what you want" for following
ones.
Rupert
== 4 of 4 ==
Date: Sun, Oct 27 2013 1:56 am
From: Rupert Swarbrick
Jorgen Grahn <grahn+nntp@snipabacken.se> writes:
> At least with Emacs, I don't think the indenting logic looks at
> #ifdefs at all.
The curly bracket in
extern "C" {
makes Emacs indent the following line. But if you manually put the first
declaration at column zero, Emacs "does what you want" for following
ones.
Rupert
==============================================================================
TOPIC: Can straight line est fit with error measure be made in single pass?
http://groups.google.com/group/comp.lang.c++/t/9d315080851a97ca?hl=en
==============================================================================
== 1 of 1 ==
Date: Sat, Oct 26 2013 10:55 am
From: Richard Damon
On 10/23/13, 8:59 AM, SG wrote:
> On Saturday, October 19, 2013 3:57:36 AM UTC+2, Alf P. Steinbach wrote:
>> It would be nice if one could make do with a non-copyable forward
>> iterator for the (x,y) data points, without storing the points.
>
> Let me just mention that this extends to any linear least squares
> problem. The amount of memory you really need is just determined by
> the number of unknowns, not the number of "data points". Suppose
>
> A x = b
>
> is an overdetermined linear equation system with very few unknowns
> (and hence very hew columns in A) but many equations (rows in A).
> Then, you can, for example, compute A^T A and A^T b of
>
> A^T A x = A^T b // Gauss' normal equation system
>
> using a single loop over all rows of A and b. A^T A will be a small
> square matrix with n^2 entries where n is the number of unknowns.
> This can then be solved with a Cholesky factorization, for example.
>
> Other approaches are possible, too. If you care about numerical
> accuracy you could "accumulate" a couple of rows and periorically
> reduce the whole system to O(n^2) memory via Householder
> transformations.
>
> Cheers!
> SG
>
Note that Least Square fits are NOT overdetermined linear equations. You
do not get a "equation" for each data point when processing, but a
multidimensional optimization problem, with one dimension for each
unknown to find. This tends to be converted to a set of equations by
taking the partial derivative of the error over each coefficient to
solve for and finding the location where all the derivatives are zero.
What is helpful is that for a large class of problems, you don't need to
keep all the data points to solve the system, but can reduce the data
points to a limited number of moments, that the solution is based on.
==============================================================================
TOPIC: String class and the use of char*/const char*
http://groups.google.com/group/comp.lang.c++/t/deff4cb6c8ab6f38?hl=en
==============================================================================
== 1 of 1 ==
Date: Sat, Oct 26 2013 11:31 am
From: Marcel Müller
On 23.10.13 11.17, goran.pusic@gmail.com wrote:
> Hi all,
>
> we seem to be having a style issue in the team.
>
> We have a string class that has char* and const char* conversion operators
operator const char* is mostly fine, but as soon as you implement
operator char* your code is close to death. There are hundreds of
drawbacks. Most importantly your code can easily have undefined behavior
where no compiler can give you any warnings or errors. (Believe me, I
have written some string classes so far.)
From my experience as soon as a C++ program uses char* (without const)
is is mostly buggy. For instance it is likely to have buffer overrun
vulnerabilities.
> (yes, i know we should be using std::string, please bear with me).
I, know, std::string is not always an option.
> Some people in the team prefer that, when calling code like this:
>
> retval func(..., const char* param, ...);
>
> with an instance of our string class, we use an explicit cast, e.g.
As I said, const char* is mostly safe. You only have to check for
dangling references, but no more than with that C API anyway.
> mystring s(whatever);
> func(..., (const char*)s, ...);
This cast is the worst case, since i would also cast mystring* or
whatever to (const char*). Things you usually don't want to do without a
compiler warning.
The common way is to provide a conversion function like c_str().
> Can I please have your opinion on this (good/bad/like/not like)? Insight?
> (My purpose, obviously, is to show your responses to the team).
- Remove operator char*.
- Remove char* from the C** source wherever possible.
- If you really need to adopt C APIs with char* without O(n) copies
provide a function like char* mystring::allocate(size_t length) that
ensures length+1 writeable characters until any other non-const mystring
function call for this instance while s[length] should not receive
anything but \0.
Marcel
==============================================================================
TOPIC: Request for build feedback
http://groups.google.com/group/comp.lang.c++/t/dc0fd05b60e1fac5?hl=en
==============================================================================
== 1 of 5 ==
Date: Sat, Oct 26 2013 1:54 pm
From: woodbrian77@gmail.com
On Thursday, July 25, 2013 9:49:22 PM UTC-5, woodb...@gmail.com wrote:
> On Thursday, July 25, 2013 6:40:12 PM UTC-5, woodb...@gmail.com wrote:
> >
>
> > The file to download is 21,059 bytes at this time so
> > downloading it shouldn't take long. On my Linux system
> > the library and two programs build in 9 seconds.
>
> I guess it's more like 7 seconds here.
>
I'm happy to report that the software builds consistently
now in under 6 seconds. This is on the same hardware and
with the same compiler as I used in July. I've made a number
of changes to the software since July that have improved the
build time.
http://webEbenezer.net/build_integration.html
I beleive the software is well written, but there is
probably room for some improvement.
== 2 of 5 ==
Date: Sat, Oct 26 2013 2:26 pm
From: Leigh Johnston
On 26/10/2013 21:54, woodbrian77@gmail.com wrote:
> On Thursday, July 25, 2013 9:49:22 PM UTC-5, woodb...@gmail.com wrote:
>> On Thursday, July 25, 2013 6:40:12 PM UTC-5, woodb...@gmail.com wrote:
>>>
>>
>>> The file to download is 21,059 bytes at this time so
>>> downloading it shouldn't take long. On my Linux system
>>> the library and two programs build in 9 seconds.
>>
>> I guess it's more like 7 seconds here.
>>
>
> I'm happy to report that the software builds consistently
> now in under 6 seconds. This is on the same hardware and
> with the same compiler as I used in July. I've made a number
> of changes to the software since July that have improved the
> build time.
>
> http://webEbenezer.net/build_integration.html
>
>
> I beleive the software is well written, but there is
> probably room for some improvement.
Hello Mr Homophobic Bigot. Where is your usual god bothering .sig?
Haven't you noticed that nobody on Usenet cares about your fucking
library yet? Best your posts on it do is start stupid discussions about
misuse of namespaces.
Lose the bigotry and go make something useful.
/Leigh
== 3 of 5 ==
Date: Sat, Oct 26 2013 3:21 pm
From: woodbrian77@gmail.com
On Saturday, October 26, 2013 4:26:14 PM UTC-5, Leigh Johnston wrote:
Please don't swear here.
I gave this thread an update in part because there are
new people rolling through here from time to time.
If you have some technical criticism of the software I'd
be happy to hear it.
== 4 of 5 ==
Date: Sun, Oct 27 2013 6:23 am
From: Leigh Johnston
On 26/10/2013 23:21, woodbrian77@gmail.com wrote:
> On Saturday, October 26, 2013 4:26:14 PM UTC-5, Leigh Johnston wrote:
>
>
> Please don't swear here.
Do you seriously believe that asking nicely will stop people swearing in
here you cunt?
>
> I gave this thread an update in part because there are
> new people rolling through here from time to time.
But your posts about it are usually random and inane like "my
compilation time changed by a second". Usenet is not your own personal
diary.
>
> If you have some technical criticism of the software I'd
> be happy to hear it.
Given your posts on it it seems like it is not a serious piece of
software from a not so serious company run by a misogynist, homophobic
bigoted god bothering lunatic.
/Leigh
== 5 of 5 ==
Date: Sun, Oct 27 2013 9:42 am
From: woodbrian77@gmail.com
On Sunday, October 27, 2013 8:23:27 AM UTC-5, Leigh Johnston wrote:
> On 26/10/2013 23:21, woodbrian77@gmail.com wrote:
>
> > On Saturday, October 26, 2013 4:26:14 PM UTC-5, Leigh Johnston wrote:
>
> >
>
> >
>
> > Please don't swear here.
>
>
>
> Do you seriously believe that asking nicely will stop people swearing
Yes, and please don't use sexual slurs here.
>
> >
>
> > I gave this thread an update in part because there are
> > new people rolling through here from time to time.
>
> But your posts about it are usually random and inane like "my
> compilation time changed by a second".
The software was good in July and is better now.
> Usenet is not your own personal
> diary.
>
Remember this part of Psalm 23.
5 You prepare a table before me in the presence of my enemies;
You have anointed my head with oil;
My cup overflows.
6 Surely goodness and lovingkindness will follow me all
the days of my life,
And I will dwell in the house of the L-rd forever.
And then bring in "One man's trash is another man's treasure."
My software may be trash to you, but to poverty stricken
people from India, China, Russia, Nepal. Egypt, Greece, Spain,
Mexico etc., it's a lifesaver. Why? Because it's free and
of increasingly high quality. G-d's will is to help His people
and they are all over the globe.
==============================================================================
TOPIC: Integer arithmetic when overflow exists
http://groups.google.com/group/comp.lang.c++/t/817dc36a142b4ac5?hl=en
==============================================================================
== 1 of 1 ==
Date: Sun, Oct 27 2013 7:58 am
From: Rosario1903
On Mon, 14 Oct 2013 14:28:37 -0500, Paavo Helde wrote:
>So far, it seems that the strongest point for putting the wrap-over into
>the standard is that otherwise a bunch of x86 and other assembler
>programmers might have some misconceptions about C++.
it is not wrapp aroudn to put in the standard is overflwo flag
>Why should we care
>so much about assembler programmers?
yes why care c++s? :)
....
>No problem, I think gcc won't optimize in debug mode and will catch my UB
>in the debug mode (i am regularly running the tests in debug mode, in
>addition to the automatic release mode testing).
....
>All tests are run after each commit, in the continous integration builds.
>No problem here, other than that we don't yet have 100% code coverage in
>tests. So I will probably switch off this flag in the stable branch
>(actually delivered to customers) in order to avoid false positives at
>customer site.
in assembly, if it would be possible some overflow, i would detect
it...
i don't know how big programmers do it etc
>Cheers
>Paavo
==============================================================================
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
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment