Friday, November 28, 2008

comp.lang.c++ - 26 new messages in 6 topics - digest

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

comp.lang.c++@googlegroups.com

Today's topics:

* incredible slowdown switching to 64 bit g++ - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/549e75880a00909c?hl=en
* Who gets higher salary a Java Programmer or a C++ Programmer? - 19 messages,
10 authors
http://groups.google.com/group/comp.lang.c++/t/4017272356b778c8?hl=en
* Types through a macro - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/bb3a4df299d49059?hl=en
* out of scope pointers in threads - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/1413d3875476ff47?hl=en
* binary format of the number. - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/bf11dd6e68624537?hl=en
* Basic .H/.CPP Location Question - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/6056e1d45918a0f9?hl=en

==============================================================================
TOPIC: incredible slowdown switching to 64 bit g++
http://groups.google.com/group/comp.lang.c++/t/549e75880a00909c?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Nov 28 2008 1:19 pm
From: nandor.sieben@gmail.com


Thank you everybody for the help. I have found the solution.
It is simple, I just need the compiler flag -ffast-math.

==============================================================================
TOPIC: Who gets higher salary a Java Programmer or a C++ Programmer?
http://groups.google.com/group/comp.lang.c++/t/4017272356b778c8?hl=en
==============================================================================

== 1 of 19 ==
Date: Fri, Nov 28 2008 1:42 pm
From: Tom Anderson


On Sat, 29 Nov 2008, Ian Collins wrote:

> LR wrote:
>
>> When an engineer designs a bridge, they may for example try to figure
>> out how the bridge will react to a given load. They may try this for
>> various loads. The load limit is determined by physics.
>>
>> What is the analogous thing for software?
>
> The Roman or medieval bridge builder who pre-dated the discovery of physics?

Despite what the Civ2 tech tree may say, the building of bridges by Romans
and medievals was not done without the aid of physics. Indeed, the
mechanics needed to build bridges, siege engines, and other such staples
of the ancient world was well advanced in classical Greece. They didn't
have calculus, or quite such an integrated picture of physics, but they
had plenty of quantitative rules.

> The Roman or medieval bridge builder was no less of an engineer than
> today's bridge builder. If anything he was more of an engineer because
> he didn't have machines to do his donkey work for him.

The Greeks built tools to calculate cube roots, which were essential to
the design of those big spear-throwing siege engines - oxybeles, i seem to
remember they're called.

Although the mathematics they used was empirical, rather than being based
on theory.

> The physics of software has not been discovered yet, so we still have to
> rely in basic engineering and scientific principals to build our
> applications.

Perhaps. There may well be a theoretical breakthrough somewhere up ahead.

> Maybe every software application has its own set of physical laws?

If so, i don't think they'd qualify as laws, would they?

tom

--
Would you like to remember more?


== 2 of 19 ==
Date: Fri, Nov 28 2008 2:07 pm
From: AL


LR wrote:

> AL wrote:

>> LR wrote:

>> [...] But to my mind that would make
>>> "software engineering" a unique thing. Different from say chemical,
>>> mechanical or civil. But perhaps there is another branch of engineering
>>> that doesn't require the application of scientific principle?

>> Perhaps there is.

> Perhaps. Perhaps not.
> I was wondering if perhaps someone could point out an instance instead
> of referring to the class.
>
> LR


deflecting - you've cornered yourself and now you are deflecting...

You posed, "perhaps there is another branch of engineering that doesn't
require the application of scientific principle" which equates to a
meaning of engineering that is not consistent with your narrow
inflexible definition.

Look up definitions in the dictionary and you will find multiple
definitions for most any given word. Use a dictionary 100yrs old and you
will not unnecessarily find the same definitions found in a modern
dictionary and you will even find new words. It may be that not everyone
appreciates the new definitions, I remember my grade school teacher's
response when "ain't" was legitimized by Webster, but there they are.

== 3 of 19 ==
Date: Fri, Nov 28 2008 2:15 pm
From: Ian Collins


Tom Anderson wrote:
> On Sat, 29 Nov 2008, Ian Collins wrote:
>
>> LR wrote:
>>
>>> When an engineer designs a bridge, they may for example try to figure
>>> out how the bridge will react to a given load. They may try this for
>>> various loads. The load limit is determined by physics.
>>>
>>> What is the analogous thing for software?
>>
>> The Roman or medieval bridge builder who pre-dated the discovery of
>> physics?
>
> Despite what the Civ2 tech tree may say, the building of bridges by
> Romans and medievals was not done without the aid of physics. Indeed,
> the mechanics needed to build bridges, siege engines, and other such
> staples of the ancient world was well advanced in classical Greece. They
> didn't have calculus, or quite such an integrated picture of physics,
> but they had plenty of quantitative rules.
>
Which is probably where software engineering is now.

>> The Roman or medieval bridge builder was no less of an engineer than
>> today's bridge builder. If anything he was more of an engineer because
>> he didn't have machines to do his donkey work for him.
>
> The Greeks built tools to calculate cube roots, which were essential to
> the design of those big spear-throwing siege engines - oxybeles, i seem
> to remember they're called.
>
> Although the mathematics they used was empirical, rather than being
> based on theory.
>
Which is probably where software engineering is now.

>> Maybe every software application has its own set of physical laws?
>
> If so, i don't think they'd qualify as laws, would they?
>
Why not? For all we know, there might be an infinite number of parallel
universes each with their own set of physical laws.

--
Ian Collins


== 4 of 19 ==
Date: Fri, Nov 28 2008 2:43 pm
From: LR


Kai-Uwe Bux wrote:
> LR wrote:

>> However, I note that I've read some stuff recently that suggests that
>> mathematicians have some doubts about the concept of proof.
>
> Where did you read that? Neither my colleagues nor myself seem to have any
> doubt about "the concept of proof". In fact, we devote a huge chunk of our
> time to train students to produce exactly that old-fashioned thing called
> proof. And I do not see any signs of change.


I have to apologize. I should have said that I can't remember where I
read it, but I do remember reading it. It might have been in a popular
science type of magazine or maybe at the link below. If it helps at all,
I think the concern was in part about complexity and in part about the
fundamental ability to prove something, but I wouldn't come close to
saying that I understood it. I do apologize again for not having
mentioned before that I can't remember where I read it.

It might have been here, but the full article seems unavailable, so I'm
not sure.
http://www.economist.com/science/displaystory.cfm?story_id=E1_PRDJGGT

LR


== 5 of 19 ==
Date: Fri, Nov 28 2008 2:56 pm
From: LR


Tom Anderson wrote:
> On Fri, 28 Nov 2008, Martin Gregorie wrote:
>
>> On Thu, 27 Nov 2008 21:13:44 +0000, Tom Anderson wrote:
>>
>>> On Thu, 27 Nov 2008, Martin Gregorie wrote:
>>>
>>>> On Wed, 26 Nov 2008 22:36:41 -0500, LR wrote:
>>>>
>>>>> Martin Gregorie wrote:
>>>>>> On Wed, 26 Nov 2008 16:32:19 -0500, LR wrote:
>>>>>>
>>>>>>> But I think I made it plain that engineers don't consider the entire
>>>>>>> physics of the bridge. They might not consider fluid interactions or
>>>>>>> wind loading or some such. The parameters are likely to be driven
>>>>>>> by budget, customer requirements or perhaps good practice.
>>>>>>>
>>>>>> That's quite wrong. The engineers who designed the Tay and the Tacoma
>>>>>> Narrows bridges ignored wind and look where that got them.
>>>>> I'm sorry, but what is quite wrong? I completely fail to understand
>>>>> how your response contradicts anything I wrote above. Please explain,
>>>>> because I utterly bewildered by your response.
>>>> This:
>>>> "But I think I made it plain that engineers don't consider the entire
>>>> physics of the bridge. They might not consider fluid interactions or
>>>> wind loading or some such."
>>>>
>>>> I suggest you do some reading about those bridges.
>>> Hold up - those examples show that, in the cases of those bridges (or
>>> Tacoma Narrows, at least), the engineers indeed did not consider wind
>>> loading!
>> Exactly so. Look back up this post and you'll see that "LR" said it
>> didn't matter whether bridge designers looked at wind loading or not
>
> No, he said they might not - and those examples clearly show that in some
> cases they didn't. And why not? Perhaps budget was a factor, as he
> suggests - the client didn't want to pay to have the job done properly.
>
> But as you imply, nobody could reasonably disagree that bridge engineers
> *should* consider wind and water, and i would imagine they almost always
> do.
>
> I think you may have been attaching different meanings to the precise
> words used, that's all.

As I said elsethread and acknowledge again, I was wrong in part.

>
> And now for something completely different - Edsger Dijkstra, writing in
> 1993, on why software engineering is "just humbug; from an academic i.e.
> scientific and educational point of view it is a sham, a fraud":
>
> http://www.cs.utexas.edu/users/EWD/transcriptions/EWD11xx/EWD1165.html

I liked part of that, but what's a "mathematical engineer"?


>
> The wikipedia article from which i cribbed that is worth a read:
>
> http://en.wikipedia.org/wiki/Debates_within_software_engineering

"Texas even goes so far as to ban anyone from writing any real-time code
without an engineering license." I smell a First Amendment case. (For
those of you who aren't in the US, sorry, that's a free speech issue.)

Thanks for those links, fascinating.

LR


== 6 of 19 ==
Date: Fri, Nov 28 2008 3:04 pm
From: "Daniel T."


Arne Vajhøj <arne@vajhoej.dk> wrote:
> Daniel T. wrote:
> > Arne Vajhøj <arne@vajhoej.dk> wrote:
> > > Matthias Buelow wrote:

> > ... I think [Arne's] conception of what constitutes "engineering"
> > in the software sense is probably too exclusive. In construction,
> > the engineers design the structure then pass it off to the
> > builders who then build it to spec. For software, the "builders"
> > are the compiler, linker, and runtime environment. The writing of
> > the code is part of the design processes.
>
> It is sometimes difficult to find a 100% matching analogy.
>
> If a project do extremely detailed design, then I will consider
> writing the actual code part of building.
>
> And it fits with:
> - it is very unlikely that a compiler turns good source code
> into bad binary code
> - it happen that a builder mess up a good blueprint
> - it happen that the programmer writing the code
> mess up a good design

A draftsman can mess up a good blueprint too. I don't think that is
relvelent.

> But very few projects do detailed design to make writing
> the code pure building. It is often a mix of lowel level
> design and building.

Writing the code is never "pure building", if it were then tools would
be doing it. Writing the code is, as you put it "low level design",
i.e., it is part of the design phase.


== 7 of 19 ==
Date: Fri, Nov 28 2008 3:06 pm
From: LR


Arne Vajhøj wrote:
> LR wrote:
>> Arne Vajhøj wrote:
>>> LR wrote:
>>>> OTOH, I've never heard of someone actually being prosecuted for calling
>>>> themselves an engineer. I repeat IANAL, but I suspect, but do not know,
>>>> that if you did something that might be considered to be malpractice
>>>> whilst calling yourself an engineer things might get interesting.
>>> If someone design a bridge, it collapses and it turns out he is a
>>> software engineer with degree in computer science, then I am sure
>>> all hell will break out.
>>>
>>> But if a software engineer designs a piece of software that crashes
>>> then I can not imagine him being prosecuted for not having an
>>> engineering degree in bridge building.
>> I think it might depend on consequences of the failure and to who and
>> why it failed.
>
> If someone prosecuted a software engineer for not having an
> engineering degree in bridge building should have their head
> examined by a shrink.
>
>> I think that engineers do sometimes get prosecuted for their failures in
>> much the same way that physicians do.
>>
>> I didn't find a specific case, and this isn't proof, but evidence. A
>> google(tm) search for engineering malpractice insurance turns up quite a
>> few hits.
>
> When I make that search there do not show any hits up about software
> engineers being prosecuted for not having an engineering degree in
> construction.

I didn't say that it would turn up hits for "software engineers". The
context didn't demand that it would. This part of the discussion was
about liability for engineers. My preface to the search was about
engineers in general.

> So please provide a link to one of your hits.

They can be found. It's not very hard. Add software or maybe "software
engineer" to the above list. And no, I don't accept this as evidence
that software development is an engineering discipline. Perhaps the
insurance industry uses the expression as a term of art.

LR

== 8 of 19 ==
Date: Fri, Nov 28 2008 3:13 pm
From: Arne Vajhøj


LR wrote:
> Arne Vajhøj wrote:
>> LR wrote:
>>> Arne Vajhøj wrote:
>>>> LR wrote:
>>>>> OTOH, I've never heard of someone actually being prosecuted for calling
>>>>> themselves an engineer. I repeat IANAL, but I suspect, but do not know,
>>>>> that if you did something that might be considered to be malpractice
>>>>> whilst calling yourself an engineer things might get interesting.
>>>> If someone design a bridge, it collapses and it turns out he is a
>>>> software engineer with degree in computer science, then I am sure
>>>> all hell will break out.
>>>>
>>>> But if a software engineer designs a piece of software that crashes
>>>> then I can not imagine him being prosecuted for not having an
>>>> engineering degree in bridge building.
>>> I think it might depend on consequences of the failure and to who and
>>> why it failed.
>> If someone prosecuted a software engineer for not having an
>> engineering degree in bridge building should have their head
>> examined by a shrink.
>>
>>> I think that engineers do sometimes get prosecuted for their failures in
>>> much the same way that physicians do.
>>>
>>> I didn't find a specific case, and this isn't proof, but evidence. A
>>> google(tm) search for engineering malpractice insurance turns up quite a
>>> few hits.
>> When I make that search there do not show any hits up about software
>> engineers being prosecuted for not having an engineering degree in
>> construction.
>
> I didn't say that it would turn up hits for "software engineers". The
> context didn't demand that it would. This part of the discussion was
> about liability for engineers. My preface to the search was about
> engineers in general.

No - you replied to:

#But if a software engineer designs a piece of software that crashes
#then I can not imagine him being prosecuted for not having an
#engineering degree in bridge building.

It would make your arguments a little easier to follow if
you replies actually are intended for what you technically
reply to.

Whether engineers responsible for a bridge collapse can
be prosecuted is not relevant in this subthread and as far
as I can tell not particular relevant for the thread at all.

Arne


== 9 of 19 ==
Date: Fri, Nov 28 2008 3:16 pm
From: Arne Vajhøj


Daniel T. wrote:
> Arne Vajhøj <arne@vajhoej.dk> wrote:
>> Daniel T. wrote:
>>> Arne Vajhøj <arne@vajhoej.dk> wrote:
>>>> Matthias Buelow wrote:
>
>>> ... I think [Arne's] conception of what constitutes "engineering"
>>> in the software sense is probably too exclusive. In construction,
>>> the engineers design the structure then pass it off to the
>>> builders who then build it to spec. For software, the "builders"
>>> are the compiler, linker, and runtime environment. The writing of
>>> the code is part of the design processes.
>> It is sometimes difficult to find a 100% matching analogy.
>>
>> If a project do extremely detailed design, then I will consider
>> writing the actual code part of building.
>>
>> And it fits with:
>> - it is very unlikely that a compiler turns good source code
>> into bad binary code
>> - it happen that a builder mess up a good blueprint
>> - it happen that the programmer writing the code
>> mess up a good design
>
> A draftsman can mess up a good blueprint too. I don't think that is
> relvelent.

I think that was what I wrote. And i think it is very relevant.

>> But very few projects do detailed design to make writing
>> the code pure building. It is often a mix of lowel level
>> design and building.
>
> Writing the code is never "pure building", if it were then tools would
> be doing it. Writing the code is, as you put it "low level design",
> i.e., it is part of the design phase.

No.

You argue that not fully automated means design.

That is obviously not true.

Else the brick layer would be designing the building.

Building engineering has not invented a widely used machine
for laying bricks.

Software engineering has not invented a widely used program
for generating executables from models (MDA tools exist but
are not widely used).

Arne


== 10 of 19 ==
Date: Fri, Nov 28 2008 3:18 pm
From: LR


AL wrote:
> LR wrote:
>
>> AL wrote:
>
>>> LR wrote:
>
>>> [...] But to my mind that would make
>>>> "software engineering" a unique thing. Different from say chemical,
>>>> mechanical or civil. But perhaps there is another branch of engineering
>>>> that doesn't require the application of scientific principle?
>
>>> Perhaps there is.
>
>> Perhaps. Perhaps not.
>> I was wondering if perhaps someone could point out an instance instead
>> of referring to the class.
>>
>> LR
>
>
> deflecting - you've cornered yourself and now you are deflecting...

Can you name an instance?


> You posed, "perhaps there is another branch of engineering that doesn't
> require the application of scientific principle" which equates to a
> meaning of engineering that is not consistent with your narrow
> inflexible definition.


I did pose that, since I wondered if there is an example counter to my
belief about what engineering is. Was I unclear? I'm not sure that I
understand your point.


Can you name an instance?


> Look up definitions in the dictionary and you will find multiple
> definitions for most any given word.

I'll start with the word cleave. ;)

> Use a dictionary 100yrs old and you
> will not unnecessarily find the same definitions found in a modern
> dictionary and you will even find new words.

"new words"? Meaning? Words I am unfamiliar with? Old words that don't
see much current usage? New to me? I'm not sure that I take your
meaning of the word new in this context.

> It may be that not everyone
> appreciates the new definitions, I remember my grade school teacher's
> response when "ain't" was legitimized by Webster, but there they are.

Then why would anyone bother to disagree with me?

LR


== 11 of 19 ==
Date: Fri, Nov 28 2008 3:29 pm
From: Keith H Duggar


On Nov 28, 12:55 pm, LR <lr...@superlink.net> wrote:
> James Kanze wrote:
> > On Nov 27, 2:05 pm, LR <lr...@superlink.net> wrote:
> >> But perhaps there is another branch of engineering that
> >> doesn't require the application of scientific principle?
>
> > They all do, including software engineering. That's part of
> > what makes them engineering.
>
> I reiterate, which scientific law is being applied in the creation of
> software? In the way, for example that a civil engineer would apply f=ma
> while building a bridge or a mech engineer would apply it while
> designing a pressure vessel?

I already provided you with several examples off-the-cuff.
Perhaps you missed them the first time; here they are again:

Principle of Induction
Pigeonhole Principle
Information Principle
Chebyshev's Inequality
Akra-Bazzi Theorem
Divide-and-Conquer
Dynamic Programming
Sieve Principle
Occam's Razor
Murphy's Law

Since scientific principles are applied regularly in software
engineering I'm mystified as to why others in this thread are
having such a hard time providing simple specific examples as
the above. Perhaps well trained software engineers are more
rare than I realized.

Below is a dictum of mine, that is germane here and provides
clearer understanding of the duality between and the purpose
of science and engineering:

"Science applies control to pursue knowledge.
Engineering applies knowledge to pursue control."

KHD

== 12 of 19 ==
Date: Fri, Nov 28 2008 3:59 pm
From: LR


Keith H Duggar wrote:

Sorry I'm so late responding to this.

> Software Engineering is replete with scientific principles.
> Here are but a few off the top of my head:

I'm not familiar with most of these and I had to look most of them up.
I'm still in the process of looking some of them up. I am unfortunately
pressed for time so I regret that I can't give each of these the
attention they deserve. So briefly, very briefly:
>
> Principle of Induction
Looks like logic.


> Pigeonhole Principle
Looks like math.


> Information Principle
I'm not sure what this means.


> Chebyshev's Inequality
Math. Probablity theory.


> Akra-Bazzi Theorem
Math.


> Divide-and-Conquer
I think this is math. The articles I find online define it as being an
algorithm design paradigm in computer science.


> Dynamic Programming
From the wikipedia article: "In mathematics and computer science,
dynamic programming..." Math.


> Sieve Principle
Math.

> Occam's Razor
Logic. Used by scientists, but not science itself.


> Murphy's Law
Ok, perhaps you got me. But it's not, I don't think, a scientific law
or principle. Maybe it should be. Or you haven't offered proof of the
law, or shown how it's applied to the production of software.

I'm certain that I've overlooked some obvious point or made some
mistake. Please feel free to point those out.


I seem to have metaphorically misplaced the post, but think I saw
someone else mention Shannon and Information Theory and in the hope that
no one minds, I'll respond here.

I think that IT might come pretty close. It does seem to use math to
describe a physical phenomenon. Border line perhaps. But I don't know
anyone who uses IT to produce code. They might write apps that
implement some part of an algorithm that involves IT, but not apply it
to the actual production of code, in the way that an engineer will
consider f=ma (or f=mv per James Kanze) when deciding how strong to make
a bridge. I wouldn't say that I understand it very well. To me it
looks like it might be of more value to electrical engineers in terms of
application.

But it's something to consider. How might it be applied to the
production of code?

LR


== 13 of 19 ==
Date: Fri, Nov 28 2008 4:04 pm
From: "Daniel T."


Tommy <plas@dacxsee.com> wrote:
> Daniel T. wrote:
> > Tommy <plas@dacxsee.com> wrote:
> >> Tom Anderson wrote:

> ... at the end of the day, considering the topic (who gets a
> higher salary among Java, C++), one who attempts to cover the gambit
> or believes the better pay will come by self-proclaiming to be a
> "Software Engineer" in his resume, better have the credentials and
> experience to back it up. A CE degree is nice, but it must also be
> coupled with practical experience.

Agreed. A CE degree is nice but ultimately not relevant IMHO. A kid
fresh out of college simply is not going to make a good Software
Engineer, he's got too much to unlearn first. Experience is the best
teacher.

> When I talking to potential hire,
> a good clue that the person has promise is when he tells me he can't
> live without his white board. :-)

I never use the damn things. Hate them. I do keep a pad of graph paper
on my desk at all times though. :-) When a coder tells me he likes to
keep the lights off, that tells me he believes the only thing that is
important is that which is on the screen. Big mistake IMHO.

> He would be just as well calling himself a "Software Developer", or
> Project Developer or Product Developer.
>
> The former tells me he has R&D experience, design experience. The
> latter tells me he has production, QA, customer relations, even
> possible technical sales and support experiences.
>
> Grant it, with today smarter tools, IDEs, etc, the many traditional
> disciplines have merged. That was the intent - not only to increase
> productivity, but to lower the cost of expertise requirements,
> increase output without increasing staff. If a developer wants to say
> he is Software Engineer because he uses these tools, even created
> tools, has experience with all the current languages, he might get
> hired, but not a SE pay scale. If he can put start a project from
> start to finish, create functional specs, communicate with others to
> fine tine it without writing a single line of code, then he/she may
> deserve the pay, but then again he probably won't be looking at a
> programming position. :-)

IMHO, if he thinks he can take a project from start to finish, create
functional specs, communicate with others and define completion dates
without writing a single line of code, he's a danger to the project.


== 14 of 19 ==
Date: Fri, Nov 28 2008 4:11 pm
From: Kai-Uwe Bux


LR wrote:

> Keith H Duggar wrote:
>
> Sorry I'm so late responding to this.
>
>> Software Engineering is replete with scientific principles.
>> Here are but a few off the top of my head:
>
> I'm not familiar with most of these and I had to look most of them up.
> I'm still in the process of looking some of them up. I am unfortunately
> pressed for time so I regret that I can't give each of these the
> attention they deserve. So briefly, very briefly:
>>
>> Principle of Induction
> Looks like logic.
>
>
>> Pigeonhole Principle
> Looks like math.
>
>
>> Information Principle
> I'm not sure what this means.
>
>
>> Chebyshev's Inequality
> Math. Probablity theory.
>
>
>> Akra-Bazzi Theorem
> Math.
>
>
>> Divide-and-Conquer
> I think this is math. The articles I find online define it as being an
> algorithm design paradigm in computer science.
>
>
>> Dynamic Programming
> From the wikipedia article: "In mathematics and computer science,
> dynamic programming..." Math.
>
>
>> Sieve Principle
> Math.
>
>> Occam's Razor
> Logic. Used by scientists, but not science itself.
[snip]

a) There is some tension about where to put math. Some place it with the
sciences, others don't. All agree that it is somewhat different. On the
other hand, each science in itself seems to be different from the others.

b) Looking for physical, chemical, or biological knowledge in programs, you
will find that there is quite a few programs that incorporate exactly that.
E.g., the software that NASA uses to guide space probes to other planets
clearly incorporates a lot of Newtonean mechanics. There are programs to
compute orbitals for molecules. Those programs embed quantum mechanics to a
large degree (although most of the program is probably devoted to top-notch
techniques of number crunching and PDE solving).

Similarly, much of the software of today is embedded in devices. If you
drive a modern car, chances are that the anti blocking system for your
brakes has a computer chip somewhere. The software therein probably
benefits a lot from physical knowledge about breaking.

Any sort of knowledge will find its way into software (e.g., software for
transactions between banks incorporates much knowledge about the particular
kinds of transactions involved). Scientific principles are no exception.


Best

Kai-Uwe Bux


== 15 of 19 ==
Date: Fri, Nov 28 2008 4:33 pm
From: Lew


LR wrote:
> AFAIK, calling yourself an engineer without the license is illegal in
> many jurisdictions, although, I don't know what the penalty is and I
> really do with to emphasize this, IANAL.

One can call oneself a "software engineer" if one wants in the U.S., thanks to
the First Amendment. One might be restricted in engaging in certain
activities that require a licensed engineer in the states that have
such requirements, but that has nothing to do with calling oneself one.

One can call oneself "God" if one wants for the same reason.

--
Lew


== 16 of 19 ==
Date: Fri, Nov 28 2008 4:34 pm
From: Lew


Tim Roberts wrote:
> The fact that it is widely used does not mean that it is CORRECTLY used.
> There are many states in which it is illegal to call yourself an "engineer"
> of any kind unless you have received an engineering license from the state,

Which ones?

> and those license examinations often involve topics in which a software
> engineer has no training.

If you are speaking of the United States, one has the First Amendment right to
call oneself whatever one likes. I can call myself President of the United
States or God, should I so choose. (Since no one agrees on what or if God is,
that last one has no conceivable actionable consequences at law.)

What one calls one's profession or business may, of course, be a different matter.

--
Lew


== 17 of 19 ==
Date: Fri, Nov 28 2008 4:34 pm
From: Lew

Joshua Cranmer wrote:
>> public class Foo {
>> public Foo() {
>> bitBucket.add(this);
>> }
>> private static java.util.LinkedList<?> bitBucket =
>> new java.util.LinkedList<?>();
>> }
>>
>> That's a memory leak (so long as bitBucket is not otherwise impacted by
>> any code path coming from a public API).

jebblue wrote:
> It doesn't even compile.

s/?/Foo/g

--
Lew


== 18 of 19 ==
Date: Fri, Nov 28 2008 4:45 pm
From: "Mike Schilling"


Lew wrote:
> LR wrote:
>> AFAIK, calling yourself an engineer without the license is illegal
>> in
>> many jurisdictions, although, I don't know what the penalty is and
>> I
>> really do with to emphasize this, IANAL.
>
> One can call oneself a "software engineer" if one wants in the U.S.,
> thanks to the First Amendment.

It's not quite that simple. One can't falsely call oneself a "medical
doctor" or "police officer" and, when challenged by legal authority,
simply point to the Bill of Rights.


== 19 of 19 ==
Date: Fri, Nov 28 2008 4:53 pm
From: Lew


Mike Schilling wrote:
> Lew wrote:
>> LR wrote:
>>> AFAIK, calling yourself an engineer without the license is illegal
>>> in
>>> many jurisdictions, although, I don't know what the penalty is and
>>> I
>>> really do with to emphasize this, IANAL.
>> One can call oneself a "software engineer" if one wants in the U.S.,
>> thanks to the First Amendment.
>
> It's not quite that simple. One can't falsely call oneself a "medical
> doctor" or "police officer" and, when challenged by legal authority,
> simply point to the Bill of Rights.

Sure, one can. One just cannot engage in acts that require that one
legitimately be a medical doctor or police officer.

I could walk into a bar and tell a girl with a fetish for policemen that I am
a police officer, and I have broken no law.

--
Lew

==============================================================================
TOPIC: Types through a macro
http://groups.google.com/group/comp.lang.c++/t/bb3a4df299d49059?hl=en
==============================================================================

== 1 of 2 ==
Date: Fri, Nov 28 2008 1:46 pm
From: blargg.h4g@gishpuppy.com (blargg)


Kaba wrote:
> Kaba wrote:
> > Is there a way around?
>
> Oh, I came up with a solution:
>
> #define DEDUCTION(x) typename Deductor<void ##x>::Result
[...]

Why ##x instead of just x? Otherwise, clever solution to passing typenames
with commas in them to a macro!


== 2 of 2 ==
Date: Fri, Nov 28 2008 2:48 pm
From: Kaba


blargg wrote:
> Kaba wrote:
> > Kaba wrote:
> > > Is there a way around?
> >
> > Oh, I came up with a solution:
> >
> > #define DEDUCTION(x) typename Deductor<void ##x>::Result
> [...]
>
> Why ##x instead of just x? Otherwise, clever solution to passing typenames
> with commas in them to a macro!

Thanks:) You are right, I removed it just after posting. Additionally, I
noticed that you can wrap the x into extra parentheses so that you need
not use double parentheses for simple types:

#define DEDUCTION(x) typename Deductor<void (x)>::Result

B<DEDUCTION((A<1, int>))> a;
B<DEDUCTION(int)> a;

I actually wrote this thing down here:

http://kaba.hilvi.org/Programming_C++/Texts/Templates_Macros.htm

The thing that motivates me to search for this kind of solution is this:

http://kaba.hilvi.org/Programming_C++/Texts/Restricted_Deduction.htm

--
http://kaba.hilvi.org

==============================================================================
TOPIC: out of scope pointers in threads
http://groups.google.com/group/comp.lang.c++/t/1413d3875476ff47?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Nov 28 2008 2:25 pm
From: "Maic Schmidt"

Your pointer seems to go "out of scope" because your procedure where you
declared the pointer ends,
and so its local variable stack is cleared.

Declare your data-pointer at class or global scope.

class SVDaemon
{
public:
void StartThread()
{
pointer = new MyData();
wndThread =
CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)WindowThread,pointer,0,&threadId
);
}
private:
MyData* pointer;
DWORD threadId;
HANDLE wndThread;
static DWORD WindowThread(MyData* data);
};

Greetz
Maic

"uche" <uraniumore235@hotmail.com> schrieb im Newsbeitrag
news:c201d729-47c7-449f-9d11-62ac37d10255@a29g2000pra.googlegroups.com...
> On Nov 28, 10:51 am, uche <uraniumore...@hotmail.com> wrote:
> > I am trying to send a pointer to the thread below; however, when the
> > thread gets executed, the pointer goes out of scope . How do I fix
> > it ?
> >
> > int mywrite(char* id, int number_of_characters, char char_array)
> > {
> > HANDLE Producer;
> >
> > DWORD ThId;
> >
> > //global_char = char_array;
> >
> > //create mutual exlusion for producer process to write into the
> > buffer
> >
> > //create producer thread and start the function for inserting
> > characters
> > //mywriteTh is the entry point of the producer
> >
> > ptr =new data;
> > ptr->character = char_array;
> > cout<<ptr->character<<endl;
> > ptr->id = id;
> > cout<<ptr->id<<endl;
> >
> > Producer = (HANDLE) CreateThread (NULL, 0, mywriteTh,
> > reinterpret_cast<data> (ptr) , 0, &ThId); // i want to send the
> > pointer to this thread
> >
> > cout<<ptr->id<<endl;
> >
> > return 0;
> >
> > }
> >
> > DWORD WINAPI mywriteTh(data ptr)
> > {
> > //global_char is available here
> >
> > DWORD tId = GetCurrentThreadId();
> >
> > data *ptr_data = reinterpret_cast<data *>(ptr); // pointer is goes
> > out of scope
> >
> > }
>
> please note: change data* to LPVOID ... HOWEVER, THIS DOESN'T SEEM TO
> DO THE TRICK! I STILL GET A POINTER THAT IS OUT OF SCOPE!

==============================================================================
TOPIC: binary format of the number.
http://groups.google.com/group/comp.lang.c++/t/bf11dd6e68624537?hl=en
==============================================================================

== 1 of 2 ==
Date: Fri, Nov 28 2008 2:51 pm
From: "Bill"

"Tarmo Kuuse" <tarmo.kuuse@mail.ee> wrote in message
news:ggod2m$3ad$1@aioe.org...
> Bill wrote:
>> Why would you prefer to write down strings of 0s and 1s anyway? Seems
>> like it would increase your chance of error. If you really wanted to,
>> you could write your own function which translates binary character
>> strings to an integral data type. For instance, int binary2Int(const
>> char *).
>
> When working at low level (embedded, device drivers, ...), bit fields are
> scattered throughout code. It is quite annoying to convert binary to
> hexadecimal and vice versa for 32-bit values.
>
> Let's see now, is bit 22 set in mask 0x03C00000? OK, give me a minute...
>
> --
> Tarmo

I think I would be MUCH less likely to make an error typing in hexadecimal
strings. The idea of typing in a string with a single 1 in the 22nd place
gives me a headache just thinking about it. I would need to
quadruple-check it. In hex, I would only need to double-check it.
Depending on the storage requirements I might prefer an array whose members
of type bool---then there is no ambiguity about what is meant by the 22nd
bit.

Bill


== 2 of 2 ==
Date: Fri, Nov 28 2008 3:09 pm
From: Kai-Uwe Bux


Bill wrote:

>
> "Tarmo Kuuse" <tarmo.kuuse@mail.ee> wrote in message
> news:ggod2m$3ad$1@aioe.org...
>> Bill wrote:
>>> Why would you prefer to write down strings of 0s and 1s anyway? Seems
>>> like it would increase your chance of error. If you really wanted to,
>>> you could write your own function which translates binary character
>>> strings to an integral data type. For instance, int binary2Int(const
>>> char *).
>>
>> When working at low level (embedded, device drivers, ...), bit fields are
>> scattered throughout code. It is quite annoying to convert binary to
>> hexadecimal and vice versa for 32-bit values.
>>
>> Let's see now, is bit 22 set in mask 0x03C00000? OK, give me a minute...
>>
>> --
>> Tarmo
>
> I think I would be MUCH less likely to make an error typing in hexadecimal
> strings. The idea of typing in a string with a single 1 in the 22nd
> place
> gives me a headache just thinking about it. I would need to
> quadruple-check it. In hex, I would only need to double-check it.
[snip]

I agree, but that is only because we are dealing with 32bit numbers. With
8bit numbers, things are different. I can see which bits are set in

01001110

right away. With a hex number such as

d3

I have to think, which is a BadThing(tm).


Best

Kai-Uwe Bux

==============================================================================
TOPIC: Basic .H/.CPP Location Question
http://groups.google.com/group/comp.lang.c++/t/6056e1d45918a0f9?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Nov 28 2008 4:03 pm
From: NvrBst


This seems like a very basic question but I can't seem to google the
answer. Should the .H and .CPP always be in the same directory? Or
is it safe to put all my ".h" file in a "inc" folder, and all my .cpp
files in a "src" folder?

MSDN says (#include"") "This form instructs the preprocessor to look
for include files in the same directory of the file that contains the
#include statement, and then in the directories of any files that
include (#include) that file.". How is the 2nd part of the statment
possible? For example

MyProj1/inc/*.h
MyProj1/src/*.cpp

MyProj2/inc/*.h
MyProj2/inc/*.cpp

Say a file in MyProj2 wants to include something in the "MyProj1/inc"
folder, it'd go "include <MyProj1File.h>" and then add -I"path/
MyProj1/inc" to the command line, would I also have to add the source
directory -I"path/MyProj2/src"?

This is just a cosmetic thing, I'm a little new to C++ and wanted to
know if I'd be laughed out of the room by having seperate "inc" and
"src" folders, and also how a header file finds it's source file (aka
just magic, the -I flag, or something else).


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

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

No comments: