Wednesday, October 8, 2014

Digest for comp.lang.c++@googlegroups.com - 25 updates in 10 topics

comp.lang.c++@googlegroups.com Google Groups
Unsure why you received this message? You previously subscribed to digests from this group, but we haven't been sending them for a while. We fixed that, but if you don't want to get these messages, send an email to comp.lang.c+++unsubscribe@googlegroups.com.
Robert Hutchings <rm.hutchings@gmail.com>: Oct 08 03:29PM -0500

Does anyone know the legal ramifications of online testing? What if
they give a test with inaccurate information? Do candidates have any
legal rights in this area?
 
-> Rob
Mark <ma740988@gmail.com>: Oct 08 12:28PM -0700

I'm receiving multipart messages from clients. These messages could be XML or imagery. The library I'm using returns a reference to the stream.
Ex:
std::istream& iss = myObject.stream();

 
At present Idetermine the size/length of the istream object by copying the istream object to a string. Ex:
 
std::string str ;
Poco::StreamCopier::copyToString ( iss, str );
 
How can I first determine the size/length of the stream before performing the copy operation?
 
I've tried.
std::streamsize const streamLen
= iss.rdbuf()->in_avail();
 
But streamLen is always zero.
Jorgen Grahn <grahn+nntp@snipabacken.se>: Oct 08 08:03PM

On Wed, 2014-10-08, Mark wrote:
> Poco::StreamCopier::copyToString ( iss, str );
 
> How can I first determine the size/length of the stream before
> performing the copy operation?
 
(Don't you mean /instead of/ performing the copy?)
 
An istream is a stream: you don't know how long it is unless you
consume it and hit the end. That way the stream can be infinitely
long.
 
Why do you want to know the size? Hopefully there is an alternative
solution to whatever problem you have.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Christopher Pisz <nospam@notanaddress.com>: Oct 08 03:05PM -0500

On 10/8/2014 2:28 PM, Mark wrote:
> std::streamsize const streamLen
> = iss.rdbuf()->in_avail();
 
> But streamLen is always zero.
 
I might be talking out my butt here, but wouldn't you cast the istream
to the particular type of stream that it really is? istream is a base
class for concrete stream types, those types having a size method.
 
I'd assume istream does not because it doesnt even know what kind of
data it contains so it cant give you the number of elements.
jacob navia <jacob@spamsink.net>: Oct 04 10:05PM +0200

Le 04/10/2014 20:14, Rick C. Hodgin a écrit :
 
> Choose life. Learn of Jesus Christ and let the truth set you free.
 
> Best regards,
> Rick C. Hodgin
 
This is a wondeful example of a religious person.
 
When asked about a good naming convention, he will answer his religious
babble without trying to address the question at all.
 
Question:
What time is it please?
 
Answer:
> Jesus Christ is the way, the truth, and the life. He commands all men
> everywhere to repent. No one will enter into Heaven unless they come
> to Him, humble themselves, ask forgiveness, and be saved.
 
Q: What is the standard C++ function to calculate the cubic root?
 
A: Jesus Christ is the way, the truth, and the life. He commands all
men everywhere to repent. No one will enter into Heaven unless they
come to Him, humble themselves, ask forgiveness, and be saved.
 
Wat a bunch of morons!
Christopher Pisz <nospam@notanaddress.com>: Oct 06 02:40PM -0500

On 10/6/2014 11:54 AM, Mr Flibble wrote:
 
> Evolution is proof that your god, Jesus, doesn't exist and also that you
> are deluded, mate.
 
> /Flibble
 
Someone had mentioned a kill file at some point. How do I set one up in
Thunderbird, so I don't have to read the religious arguments between
Fibble and Rick Hodgin?
Ian Collins <ian-news@hotmail.com>: Oct 07 09:03AM +1300

Christopher Pisz wrote:
 
> Someone had mentioned a kill file at some point. How do I set one up in
> Thunderbird, so I don't have to read the religious arguments between
> Fibble and Rick Hodgin?
 
Tools->Message Filters
 
--
Ian Collins
drew@furrfu.invalid (Drew Lawson): Oct 08 12:31PM

In article <fd595372-d00f-4229-8d5c-b43aff1252ca@googlegroups.com>
>On Saturday, October 4, 2014 12:58:58 PM UTC-4, Charles J. Daniels wrote:
>> [snip]
 
>Jesus Christ is the way, the truth, and the life.
 
Bacchus is the way, the juice, and the life of the party.
He commands all men to BYOB and give themselves fully to the orgy.
 
 
--
|Drew Lawson | Mrs. Tweedy! |
| | The chickens are revolting! |
Christopher Pisz <nospam@notanaddress.com>: Oct 06 02:45PM -0500

On 10/2/2014 4:10 PM, Richard wrote:
 
> If you want to supply a restful API from your C++ based server, then
> you might want to look at this stack overflow thread:
> <http://stackoverflow.com/questions/15183232/library-for-restful-api-in-c>
 
I've got a REST architecture in. It really isn't the best for relational
data, I am finding, because you have to make so many calls to first get
the data that tells you what other data you might be interested in. The
SOAP based ones seem better in that regard in that there is usually some
method with an argument list which could be a collection of foreign
keys, rather than a URL that ends up having a parameter list 1000s of
arguments long.
 
But it ends up, I have to support almost any feasable way someone would
want to give me data. So, I need Rest and Soap.
 
I did find Microsoft evidently created a native C++ web services library
and it was super easy to use and very clean compared to Gsoap, but there
seems to be issues with getting it from them for pre windows 7 machines.
Wouter van Ooijen <wouter@voti.nl>: Sep 29 07:26PM +0200


> Actually I need someone programming engineering software,
> who would like to read the tutorial and tell me
> what is missing for his/her software application needs.
 
I hope you are aware that something like this exists in boost? In what
sense is your work different or even better than the boost solution?
 
Some points that are IMO important for such a library, especially for
small microntrollers:
- do you differentiate between absolute and relative values (for
instance for time, but also for location/distance)
- can you work with non-floating-point base types (especially
fixed-point types implemented on top of integers)?
- can you work with mixed base types (for instance fixed-point types
based on integers of various size and scaling)?
 
(Sorry for being to lazy to read all documentation myself before I ask.)
 
Wouter van Ooijen
Ronald <rlc@vlinder.ca>: Oct 05 04:23PM


> I think that small micro-controllers, that is computers that address no
> more than 64 KB of code, are still used, and that for that C++ language
> is not actually used and should not be actually used.
[putting flamethrower away]
Let's agree to disagree, shall we?
 
<snip>
 
> this statement
> cout << vect1<units>(10) / vect1<seconds>(2) << endl;
> outputs "5 Hz".
That looks nice!
I'm assuming you'd have some "using namespace"s to make this actually work?
Also, when compiled, there's no difference between a volt * amperes and a
float * float?
 
I'll go take a look :)
 
rlc
Ronald <rlc@vlinder.ca>: Oct 04 10:19PM


> Claiming that software for those must be written in C is like
> claiming that engineering or scientific analysis software has
> to be written in Fortran.
I can second that: I've been working on embedded devices for over a decade
now and while I've worked with micro-controllers that required very small
footprints, by far most devices I've seen had quite powerful processors,
and all could be programmed in C++.
 
For me, the important part of an engineering units library would be that it
upholds the "zero overhead" principle: if behind the scenes a "Volt" is
simply a float (or a double), it should take no more place than that float
and should be no more costly to work with. Ideally, it would also know, at
compile-time, that Volts multiplied by Amperes give a Watts, and that it
doesn't make sense to add them; that a dimensionless value divided by
seconds would give Hertz, etc., with compile-time checks for the operations
that make sense and no run-time overhead.
 
That, btw, is something C cannot do (its type system is too weak).
 
<snip>
 
rlc
Luca Risolia <luca.risolia@linux-projects.org>: Oct 05 05:14PM +0200

> is more understandable than the former one.
> But as my library is still in development,
> I accept suggestions for a renaming.
 
To make the things more readable, I suggest that you also provide one
factory for all the points and one factory for all the vect's, which
return the right type according to the number of passed arguments, for
example;
 
auto x = make_vect<meters>(0, 0); // vect2
auto y = make_vect<meters>(0, 0, 0); // vect3
 
auto p = make_point<meters>(0, 0); // point2
auto q = make_point<meters>(0, 0, 0); // point3
Wouter van Ooijen <wouter@voti.nl>: Oct 08 07:37AM +0200

peter koch schreef op 07-Oct-14 10:57 PM:
>> solution', if not, can you explain the difference?
 
>> Wouter
 
> Sorry - I did not realize that there was a page 2 on the link. The second solution is exactly what I meant was the correct C++ solution.
 
OK. But a pity you did not have something else in mind - I was hoping
for yet another type of solution.
 
BTW are you aware of any existing library for small chips that takes
this approach?
 
Wouter
Juha Nieminen <nospam@thanks.invalid>: Oct 08 07:44AM

> memory, virtual functions, etc., are banned or discouraged), clear code
> flow (so you avoid exceptions), and code correctness (this also means
> knowing all your code, and therefore keeping source sizes to the minimum).
 
I actually fail to see any relevant difference to my style of C++
programming.
 
If I can easily avoid allocating memory dynamically, I do so (because
dynamic memory allocation is awfully slow in languages that use the
libc allocator). I never use virtual functions just for the sake of
using them (I don't have a problem in using them if they are the best
solution to the problem at hand, but I don't just throw 'virtual'
uselessly there just to make it look more C++'ish). If you are not
programming in a manner that code flow is clear, then you are doing
it wrong, no matter what the target system is. And code correctness?
I thought that was a given. Or are there really C++ programmers who
don't care for code correctness?
 
I know that a lot of misguided C++ programmers will just eg. throw
dynamic data containers into situations that really don't need them
at all (such as using std::vector for a small array that always has
a fixed size known at compile time), but I am savvier than that.
It's actually surprising how much can be done with no, or minimal,
dynamic memory allocation ("minimal" in the sense of how many
'new' calls are done.)
 
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
David Brown <david.brown@hesbynett.no>: Oct 08 11:07AM +0200

On 08/10/14 09:44, Juha Nieminen wrote:
>> knowing all your code, and therefore keeping source sizes to the minimum).
 
> I actually fail to see any relevant difference to my style of C++
> programming.
 
I get what you are saying. Different people have different styles and
habits, so the difference between "small systems C++" and "big systems
C++" is going to vary significantly. I'm only talking about general
guidelines and priorities, not fixed rules.
 
 
> If I can easily avoid allocating memory dynamically, I do so (because
> dynamic memory allocation is awfully slow in languages that use the
> libc allocator).
 
Many people /do/ use dynamic memory unnecessarily, such as by using
std::vector when std::array (or a plain C array) would do the job just
as well. Many people have habits of using "new" to create objects when
it would be possible to have them on the stack. Sometimes it is a
matter of emphasising flexibility over the disadvantages of dynamic
memory, other times it is just habit, style, emphasis of development
time over runtime, or even laziness. Certainly it is common to view
dynamic memory on big systems as almost free - both in terms of speed
and quantity. Priorities /should/ be different here between "big
systems" and "small systems".
 
> using them (I don't have a problem in using them if they are the best
> solution to the problem at hand, but I don't just throw 'virtual'
> uselessly there just to make it look more C++'ish).
 
Again, many people do use virtual functions when not strictly necessary,
perhaps with an aim to making their classes more flexible.
 
> it wrong, no matter what the target system is. And code correctness?
> I thought that was a given. Or are there really C++ programmers who
> don't care for code correctness?
 
Yes, there are really programmers of all sorts who are not particularly
concerned about code correctness. You may have noticed that some
programs are shipped with bugs in them? Those programs are not correct.
 
"Code correctness" is more than just "write something that makes sense,
test and see that it works". It is a whole range of ideas, including
formal test suites, code reviews, mathematical proof of correctness,
advanced static checkers, run-time checkers, coding styles, development
strategies, etc. At the top end of the scale, where people write code
for things like flight control systems, development teams can be happy
with average coding rates of a couple of lines per day per programmer.
For most programming tasks, far higher coding rates are required.
 
I realise this is a generalisation, and all generalisations are false,
but small system embedded development usually places more emphasis on
code correctness than PC or "big system" programming.
 
> dynamic data containers into situations that really don't need them
> at all (such as using std::vector for a small array that always has
> a fixed size known at compile time), but I am savvier than that.
 
As noted above, developers vary enormously. I am not trying to say that
/you/, as a "big systems" developer, don't care about code correctness
and are happy to use dynamic memory at all opportunities. I am merely
giving general patterns.
 
And I think that a lot of "big systems" programmers would benefit from
working for a while in a serious embedded development arena, to learn
from techniques that are more common there and take them back to their
Windows or *nix programming - the results would often be higher code
quality.
 
Luca Risolia <luca.risolia@linux-projects.org>: Oct 06 09:35PM +0200

Il 06/10/2014 20:15, Scott Lurndal ha scritto:
 
> There is 40 years of legacy C code out there, including several operating
> systems, Oracle's RDBMS and many other very large codebases.
 
> Nobody in their right mind would spend the $$ to rewrite it in C++.
 
More importantly, nobody would spend the $$ to write anything similar in C.
"Öö Tiib" <ootiib@hot.ee>: Oct 07 04:47PM -0700


> That's better, but I don't like having cmw_account_info in
> there. The original doesn't need that and it looks to me
> like a hindrance.
 
To me that 'matchesLoggedInUser' feels a bit misleading, I would
use 'isAccountOfRequest'. However 'cmw_account_info'? It is such
average name, only half of it is meaningless bloat and nothing
is misleading. Tolerable. Try sometimes some real fluff names like
'cmw_account_item_data_storage' ... those you will hate. ;)
"Charles J. Daniels" <chajadan@gmail.com>: Oct 07 10:12PM -0700


> Brian
 
> Ebenezer Enterprises
 
> http://webEbenezer.net
 
Generic lambdas, part of C++14 which I've not worked with, would allow use of auto over the specific type, if I understand correctly. That would mirror your preferred implementation. There are already existing compilers that can handle such as a thing is also my understanding, including MSVC.
legalize+jeeves@mail.xmission.com (Richard): Oct 07 11:52PM

[Please do not mail me a copy of your followup]
 
Update: I've removed the page, pending permission from Addison-Wesley.
Bjarne is not opposed to the idea, but A-W owns the copyright.
Hopefully we'll get permission. If not, buy the book :-), it's full
of good advice.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
Stuart <DerTopper@web.de>: Oct 08 06:53AM +0200

On 10/08/14, Richard wrote:
> Bjarne is not opposed to the idea, but A-W owns the copyright.
> Hopefully we'll get permission. If not, buy the book :-), it's full
> of good advice.
 
 
Hopefully you don't have to pay a fine. A buddy of mine put some
pictures of Lyonel Feininger on his homepage (he lives in the town that
got painted by Feininger quite frequently). After half a year he got a
letter from the copyright owner who claimed 500€/month/picture, and my
buddy had 6 pictures on his page. Luckily the copyright owner could only
prove that the pictures were to be seen for a single month, so he got
away with 3.000€ ... :-(
 
Best luck,
Stuart
Ian Collins <ian-news@hotmail.com>: Oct 04 10:58PM +1300

MikeCopeland wrote:
 
>> What made you reach that conclusion?
 
> The fact that using the iterator invalidates itself, so deleting via
> a scalar index would work better. (Perhaps I'm confused...once again.)
 
I think you are (confused). Look up the delete method for containers.
See what it returns and look at the examples posted of how to use it.
 
--
Ian Collins
Stuart <DerTopper@web.de>: Oct 01 08:09AM +0200

On 9/30/2014, Stuart wrote:
>> rates that are offered in most freelancer websites, I'd say that
>> McDonalds employees are only slighly less paid.
> SNIP
 
 
On 09/30/14, Christopher Pisz:
> everything you do. i.e No, you cannot create a video game on your own
> while working for a game studio. You can however invent the best flap
> jack recipe.
 
 
I'm totally fine with an intellectual property clause. It was the claim
on everything that bothered me (like Osmium's friend, who was not even
allowed to publish a novel that he wrote in his spare time). If my boss
forbade me to make contributions to Open Transport Tycoon I'd be
seriously mad ;-)
 
 
> know the details of how that works, only that it results in a
> maintenance nightmare. Perhaps that's what you are referring to when you
> compare salaries.
 
I was referring to the salaries offered on the free-lancers websites.
Most job offers boil down to 1$/hr, which is probably the average salary
in India.
 
> around $80,000 and seniors typically make $100,000+ last I checked. It
> varies with your niche and city though.
 
> Are Europeans making less? Their money is worth more, so perhaps. I dunno.
 
I can only tell about the German rates, which are 30K € for a beginner
and 40K € to 60K € for senior programmers (this applies to the former
Eastern Germany, you'll probably get a 1.3 to 1.5 higher salary in the
Western part of Germany). Apparently that is a lot less than what
American software engineers are getting, which is probably the reason
why Germany has very little to offer with regard to software products
(except for SAP, I guess).
 
Thanks for your numbers,
Stuart
Geoff <geoff@invalid.invalid>: Sep 30 07:48PM -0700

On Tue, 30 Sep 2014 12:27:31 +0000 (UTC), drew@furrfu.invalid (Drew
Lawson) wrote:
 
 
>Somewhat, this is for legal convenience. How do you prove that
>your project was done on your home computer, rather than on the
>company's dime?
 
Quite simply, the evidence of the work will be on your personal
computer and not on the company computer. In case law, the burden of
proof is on the plaintiff, not the respondent. They can, of course,
use an army of lawyers to intimidate the respondent and attempt to
bankrupt him but if they don't prevail, the counter-suit would make
the former employee very rich indeed.
 
If a company claims ownership of intellectual property they must prove
they paid for it to be done, it was assigned to you to be done, it was
done on their equipment or on their premises or on company time. If
they fail to prove one or more of those elements then they don't own
the work.
 
Blanket, "we own everything that exists or may exist in your head or
was made by your hands for all time and times to come" clauses are
simply not enforceable and this has been adjudicated in the U.S.
several times.
 
Additionally, non-competition clauses are illegal and unenforceable in
California and some other jurisdictions. A non-key employee is
perfectly safe _independently_ developing his own IP on his own time
using non-company tools and resources in his basement and starting his
own business. That's the whole point of free enterprise, isn't it?
Jorgen Grahn <grahn+nntp@snipabacken.se>: Oct 01 11:21AM

On Wed, 2014-10-01, peter koch wrote:
> so I do not know how that idea got stuck in my head.
> Perhaps because Mike wrote something like "delete object from a vector"?
> Sorry about the noise.
 
If it was noise, it was of a useful kind. Never hurts to remind
people what std::remove_if() does and doesn't do!
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: