http://groups.google.com/group/comp.lang.c++?hl=en
comp.lang.c++@googlegroups.com
Today's topics:
* Exception Misconceptions: Exceptions are for unrecoverable errors. - 16
messages, 4 authors
http://groups.google.com/group/comp.lang.c++/t/786cfdf0ab25866d?hl=en
* String not printing data on next line despite \n in the string - 1 messages,
1 author
http://groups.google.com/group/comp.lang.c++/t/35658d761ffe5130?hl=en
* C++ jobs down another 40% - 8 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/6718a9cd2f3ecdbf?hl=en
==============================================================================
TOPIC: Exception Misconceptions: Exceptions are for unrecoverable errors.
http://groups.google.com/group/comp.lang.c++/t/786cfdf0ab25866d?hl=en
==============================================================================
== 1 of 16 ==
Date: Fri, Dec 25 2009 3:50 pm
From: James Kanze
On Dec 25, 10:32 pm, ta...@mongo.net (tanix) wrote:
> In article <hh3co5$nd...@news.albasani.net>, Branimir
> Maksimovic <bm...@hotmail.com> wrote:
[...]
> >Virtual machines are always slower then real machines....
> This is a blanket statement by someone who is obscessed with
> machine cycles while his grand piece of work is not even worth
> mentioning, I'd say.
Above all, it's a statement made by someone who's never made any
actual measurements, nor spoken to experts in the field.
--
James Kanze
== 2 of 16 ==
Date: Fri, Dec 25 2009 3:55 pm
From: Branimir Maksimovic
James Kanze wrote:
> On Dec 25, 10:32 pm, ta...@mongo.net (tanix) wrote:
>> In article <hh3co5$nd...@news.albasani.net>, Branimir
>> Maksimovic <bm...@hotmail.com> wrote:
>
> [...]
>>> Virtual machines are always slower then real machines....
>
>> This is a blanket statement by someone who is obscessed with
>> machine cycles while his grand piece of work is not even worth
>> mentioning, I'd say.
>
> Above all, it's a statement made by someone who's never made any
> actual measurements, nor spoken to experts in the field.
>
How do you know that?
Greets
== 3 of 16 ==
Date: Fri, Dec 25 2009 4:09 pm
From: Branimir Maksimovic
James Kanze wrote:
>
> The few measurements I've made would bear you out. I'm sure
> that there are applications where C++ will be faster, and there
> are probably some where Java will be faster, but for most
> applications, C++ is chosen not for speed, but because it has
> greater expressibility.
No. Java is chosen because it is simplified language which
anyone can learn and maintain in one month. C++ is ugly
and complex language with lot of traps and
require several years and tears to learn.
Java sacrifices lot of things, but is faster language
in a sense that programmer can use it effectively and
write working programs in much shorter time then in c++.
Simple as that. While c++ has more tools and power
as language, once you've learn it you can do better
than in java. But lot of programmers are not capable
to produce code in time, therefore java wins.
Greets.
== 4 of 16 ==
Date: Fri, Dec 25 2009 4:09 pm
From: tanix@mongo.net (tanix)
In article <hh3gcm$t39$1@news.albasani.net>, Branimir Maksimovic <bmaxa@hotmail.com> wrote:
>tanix wrote:
>> In article <hh3ebp$q3r$1@news.albasani.net>, Branimir Maksimovic
> <bmaxa@hotmail.com> wrote:
>>> tanix wrote:
>>>>> For example php with popen calling c executable in my experience
>>>>> is about three times faster as a server than jetty/solr
>>>>> for example...
>>>> Well, if you use even PHP as some kind of argument, then you
>>>> are obviosly not seen the forest. Because PHP is one of the
>>>> worst dogs overall. Because it is weakly typed language.
>>>>
>>>> Even Python beats it hands down.
>>> No. cath is not in php, rather c executable for every request
>>> initializes about 256 mb of ram of data every time and
>>> uses simple printfs to return through pipe result to php,
>>> and perfomrs three times faster then java jetty/solr which
>>> hodls everything initizalized in memory...
>>> as a search engine...
>> Well, I'd be curious to see more specifics on this.
>
>You want me to tell which search engine it is ;)
Not necessarily. But I am impressed already.
>I can;t tell you that...
But can you tell me more specifics on how exactly things
differed so drastically.
>Greets
--
Programmer's Goldmine collections:
Tens of thousands of code examples and expert discussions on
C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript,
organized by major topics of language, tools, methods, techniques.
== 5 of 16 ==
Date: Fri, Dec 25 2009 4:13 pm
From: tanix@mongo.net (tanix)
In article <55a68459-63e7-4da4-b667-1c6892b7b9d0@r24g2000yqd.googlegroups.com>, James Kanze <james.kanze@gmail.com> wrote:
>On Dec 25, 7:01 pm, ta...@mongo.net (tanix) wrote:
>> In article
>> <ec7d2a9b-ee76-46b6-ae3a-587d199b6...@s3g2000yqs.googlegroups.com>,
>> James Kanze <james.ka...@gmail.com> wrote:
>
> [...]
>> >> virtual machine is also heavy performance killer...
>
>> >Which explains why some of the leading experts in
>> >optimization claim that it is necessary for the best
>> >optimization. (I don't fully buy that claim, but a virtual
>> >machine does have a couple of advantages when it come to
>> >optimizing: it sees the actual data being processed, for
>> >example, and the actual machine being run on, and can
>> >optimize to both.)
>
>> Yep. And the more high level some abstraction is, the more
>> performance it can gain and the less of even theoretical
>> advantage any other approach may claim.
>
>More generally, the more information a compiler has, including
>information concerning why some operation is taking place, the
>better it can optimize. It's pretty well established that when
>the language has built in bounds checking (so the compiler knows
>the why of the comparisons), the compiler can generate better
>code.
>
>In the case of a VM, of course, the compiler has very exact
>knowledge about the input data, the frequency of the various
>paths, and the CPU it is running on. All of which are important
>information. Where I have my doubts is because in a VM, the
>compiler is severely limited in the time it can take for its
>analysis; if an optimizing compiler takes a couple of hours
>analysing all of the variations, fine, but in a VM? But since
>I'm not an expert in this field, I don't really know.
>
>> >> > And that is one of central issues with Java.
>
>> >> Yes.
>> >> I think java is designed in such way that it will still be
>> >> slow in comparison to other compiled languages...if it is
>> >> compiled language.
>
>> >First, Java is a compiled language, and second, it's not
>> >slower than any of the other compiled languages, globally.
>> >(Specific programs may vary, of course.)
>
>> And that is exactly what I am seeing in my own situation.
>
>The few measurements I've made would bear you out. I'm sure
>that there are applications where C++ will be faster, and there
>are probably some where Java will be faster, but for most
>applications, C++ is chosen not for speed, but because it has
>greater expressibility.
Interesting subject.
Not sure if it is that simple to argue this expressibility argument.
--
Programmer's Goldmine collections:
Tens of thousands of code examples and expert discussions on
C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript,
organized by major topics of language, tools, methods, techniques.
== 6 of 16 ==
Date: Fri, Dec 25 2009 4:17 pm
From: Branimir Maksimovic
tanix wrote:
>
> But can you tell me more specifics on how exactly things
> differed so drastically.
Enough to say that one programmer thought to replace php
part with java server, and of course php was faster.
He didn;t figure that out either...
Greets
--
http:
== 7 of 16 ==
Date: Fri, Dec 25 2009 4:20 pm
From: tanix@mongo.net (tanix)
In article <35d326dd-b7ac-4c55-8f33-cdf092c414be@a32g2000yqm.googlegroups.com>, James Kanze <james.kanze@gmail.com> wrote:
>On Dec 25, 2:30 pm, r...@zedat.fu-berlin.de (Stefan Ram) wrote:
>> James Kanze <james.ka...@gmail.com> writes:
>> >As I said before, never trust a benchmark you haven't falsified
>
>> Yes, of course, it all starts with the fact, that one cannot
>> compare the speed of languages but only the speed of
>> specific programs running under a specific /implementation/
>> of a language running under a specific operating system
>> running on a specific hardware.
>
>Yes. And the fact that any given implementation (and any given
>language, for that matter) will have it's strong points and its
>weak points. If you want a language to look good, you write to
>its strong points, and to the other languages weak points.
>
>> What is language-specific is only the fact that some
>> language features make some kinds of optimization possible
>> (like restrict in C) or impossible (e.g., when aliasing by
>> pointers is possible).
>
>There's possible and impossible, but but there's also
>difficulty. There are C++ compilers, for example, which use
>profiler output, and if it makes a difference, generate two
>versions of a function, depending on whether there is aliasing
>or not, with a quick test at the top to decide which one to use.
>But it's a lot more effort than in Java. Similarly, given an
>array of Point (where Point is basically 2 double), it's
>perfectly conceivable that a Java compiler treat it as an array
>of double[2]. But it's a lot more work, and a lot less likely,
>than for a C++ compiler.
>
>> So, if I had to implement some algorithm, I would not refuse
>> Java from the first, because it is slow , but do some
>> benchmarking with code in the direction of that algorithm.
>
>Exactly. Most of the time, what eliminates Java is that it
>doesn't support really robust programming.
Wow. That bites. I'd be curious to see some specifics on this.
>> After all, /if/ Java is sufficiently fast for my purpose,
>> it gives me some conveniences, such as run-time array index
>> checking, automatic memory management and freedom from
>> the need for (sometimes risky) pointer arithmetics.
>
>It also pretty much makes programming by contract impossible,
>requires implementations of concrete classes to be in the same
>file as the class definition,
And THAT is a ROYAL drag. No questions about it.
> and does a number of other things
>which make programming in the large difficult.
Well... I don't know what kind of things you are talking about.
>That said, it's not a bad language for small non-critical
>applications.
Except it is routinely used in MASSIVELY scaled apps
in banks, Wall street, etc. I just see those guys too often.
> And it has a pretty nice GUI library, and is well
>integrated in web server environments.
--
Programmer's Goldmine collections:
Tens of thousands of code examples and expert discussions on
C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript,
organized by major topics of language, tools, methods, techniques.
== 8 of 16 ==
Date: Fri, Dec 25 2009 4:38 pm
From: tanix@mongo.net (tanix)
In article <hh3k76$36i$1@news.albasani.net>, Branimir Maksimovic <bmaxa@hotmail.com> wrote:
>James Kanze wrote:
>>
>> The few measurements I've made would bear you out. I'm sure
>> that there are applications where C++ will be faster, and there
>> are probably some where Java will be faster, but for most
>> applications, C++ is chosen not for speed, but because it has
>> greater expressibility.
>
>No. Java is chosen because it is simplified language
I like to hear that one. Makes me feel good.
> which anyone can learn and maintain in one month.
Well, I thought just the other way around.
At least if you talk to java experts and they ARE experts
by any measure.
What they say is something like:
"well, sure, java has much steaper learning curve.
But once you ease into it, it is a totally different game".
I'd say, from my own experience, yes, even after spending
years with C++, it took me quite a while to completely
rethink almost all I knew, and the further I got, the better
it got. I, personally, think that java overall has MUCH
more "expressive power", except we may imply different things
by it.
The ease with which I work in Java could not be even COMPARED
to C++, which was constant pain on the neck with all sorts
of secondary issues I would not even want to worry about.
Just don't ask me what are those.
The last time I looked on my firewall app in C++, it was like,
oh, jeez, I have to see THIS stuff again?
True, it was the MFC flavor of it. But, I would not write
anything but the simpliest apps in C++ on the level of some
tool or gadget. Too much foolishness, too much unnecessary
complexities that do not buy me too much.
> C++ is ugly
Agreed!!!!
:--}
>and complex language with lot of traps and
>require several years and tears to learn.
Now that you say it, I might even start thinking THIS way!
:--}
>Java sacrifices lot of things, but is faster language
>in a sense that programmer can use it effectively and
>write working programs in much shorter time then in c++.
At least that is what I saw.
And I mean MUCH easier, at least for me.
If you asked me to rewrite my main app in C++,
I'd say sorry.
>Simple as that. While c++ has more tools and power
>as language, once you've learn it you can do better
>than in java. But lot of programmers are not capable
>to produce code in time, therefore java wins.
Well, the problem with producing "code in time" is often
caused by the fact that first comes the time, which is
your "deadline", and then comes the job, and only THEN
comes a job description.
I think it wears out a lot of people, by being forever
whipped to get this time. Too much frustration, too much
overstressing of people. Too little rationale behind it.
If you work with budget and top corporate "strategies",
all you have is the amount of money we are willing to
spend on it and then comes the time frame "to be competitive".
Then a rough estimation of human resources,
pretty much pulled out of the hat, without even knowing
what exactly needs to be done and what kind of issues
are going to be addressed and what kind of problems
are going to appear out of the blue.
Then, managers like to pull these magic 3 months numbers,
no matter what. Whether they have 3 people or 6 people,
they'd have to do it in 3 months. If you port a kernel,
you may get 6 months, or even 12 months. But then you
have to have REAL big guns financing such a long trip.
>Greets.
--
Programmer's Goldmine collections:
Tens of thousands of code examples and expert discussions on
C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript,
organized by major topics of language, tools, methods, techniques.
== 9 of 16 ==
Date: Fri, Dec 25 2009 7:21 pm
From: Kaz Kylheku
On 2009-12-25, Branimir Maksimovic <bmaxa@hotmail.com> wrote:
> tanix wrote:
>>> Virtual machines are always slower then real machines....
>>
>> This is a blanket statement by someone who is obscessed with
>> machine cycles while his grand piece of work is not even worth
>> mentioning, I'd say.
>
> Well, I've started and stopped application which controlled Shanghai
> airptort back in 1993.
This is inconsistent with the observation that you write bullshit
that we might expect from someone who was /born/ in 1993.
== 10 of 16 ==
Date: Fri, Dec 25 2009 8:28 pm
From: Branimir Maksimovic
Kaz Kylheku wrote:
> On 2009-12-25, Branimir Maksimovic <bmaxa@hotmail.com> wrote:
>> tanix wrote:
>>>> Virtual machines are always slower then real machines....
>>> This is a blanket statement by someone who is obscessed with
>>> machine cycles while his grand piece of work is not even worth
>>> mentioning, I'd say.
>> Well, I've started and stopped application which controlled Shanghai
>> airptort back in 1993.
>
> This is inconsistent with the observation that you write bullshit
> that we might expect from someone who was /born/ in 1993.
Well, that depends...I was born in 68'.
Let me show you one thing:
Number of nodes: 5855000
Timer: initial randomize: 0.818023
Timer: merge_sort: 5.558880
Timer: randomize after merge: 1.201952
Timer: radix_sort: 2.021901
Timer: randomize after radix: 1.470415
Timer: quick_sort after radix: 3.805699
vnode size : 5855000
Timer: quick_sort nodes by address: 0.730361
Timer: quick_sort: 0.505779
Timer: randomize after quick: 0.911052
cummulative result:
----------------------------------
initial randomize: 3.470863
merge: 21.176704 randomize: 5.611846
radix: 8.425690 randomize: 6.397170
quick sort nodes by address: 3.909824 > vector<void*> quick sort then
fill linked list with nodes sorted by address
quick no address sort after radix: 15.180166 > unoptimized linked list,
, nodes are not sorted by address
quick: 2.297783 randomize: 4.075525 > nodes are sorted by address....
7 times faster same algorithm, almost 6 million nodes
Pt count created:999999
true
true
qsort:0.06568 > this is cache optimized quick sort of million elements
vector
sort:0.134283 > this is sort from gcc lib
lqsort:0.19908 > this is cache optimized sort of linked list of million
elements
lsort:0.437295 > this is linked list sort from gcc's lib
Pt count:0
Which virtual machine can perform crucial cache optimizations?
Greets
== 11 of 16 ==
Date: Fri, Dec 25 2009 9:38 pm
From: Kaz Kylheku
On 2009-12-25, Branimir Maksimovic <bmaxa@hotmail.com> wrote:
> James Kanze wrote:
>> On Dec 23, 11:21 pm, Branimir Maksimovic <bm...@hotmail.com> wrote:
>>> tanix wrote:
>>>> In article <hgskgk$kc...@news.albasani.net>, Vladimir Jovic <vladasp...@gmail.com> wrote:
>>>> C++ would probably be benefited tremendously if it adopted some
>>>> of the central Java concept, such as GC, threads and GUI.
>>
>>> GC is heavy performance killer especially on multiprocessor systems
>>> in combination with threads....it is slow, complex and inefficient...
>>
>> Obviously, you've never actually measured. A lot depends on the
>> application, but typically, C++ with garbage collection runs
>> slightly faster than C++ without garbage collection. Especially
>> in a multi-threaded envirionment,
>
> How that can possibly be?
How it can be is that surprising truths in the world don't take a pause
so that morons can catch up.
> GC kills all threads when it has
> to collect?
Big news: stopping threads using the scheduler is more efficient than
throwing locks or atomic instructions in their execution path.
What's more efficient: pausing a thread once in a long while, or having
it constantly trip over some atomic increment or decrement, possibly
millions of times a second?
> Or it can magically sweep through heap,stack,bss
> etc and scan without locking all the time or stopping program?
The job of GC is to find and reclaim unreachable objects.
When an object becomes unreachable, it stays that way. A program does
not lose a reference to an object, and then magically recover the
reference. Thus, in general, garbage monotonically increases as
computation proceeds.
This means that GC can in fact proceed concurrently with the
application. The only risk is that the program will generate more
garbage while GC is running, which the GC will miss---objects which GC
finds to be reachable became unreachable before it completes.
But that's okay; they will be found next time.
This is hinted at in the ``snapshot mark-and-sweep'' paragraph
in the GC algorithms FAQ.
http://www.iecc.com/gclist/GC-algorithms.html
> Explain to me how?
Go study garbage collection. There is lots of literature there.
It's not a small, simple topic.
> Manual deallocation does not have to lock at all....
WTF are you stuipd?
Firstly, any comparison between GC and manual deallocation is moronic.
In order to invoke manual deallocation, the program has to be sure
that the object is about to become unreachable, so that it does
not prematurely delete an object that is still in use. Moreover,
the program has to also ensure that it eventually identifies all objects
that are no longer in use. I.e. by the time it calls the function, the
program has already done exactly the same the job that is done by the
garbage collector: that of identifying garbage.
/Both/ manual deallocation and garbage collection have to recycle
objects somehow; the deallocation part is a subset of what GC does.
(Garbage collectors integrated with C in fact call free on unreachable
objects; so in that case it is obvious that the cost of /just/ the call
to free is lower than the cost of hunting down garbage /and/ calling
free on it!)
The computation of an object lifetime is not cost free, whether it
is done by the program, or farmed off to automatic garbage collection.
Your point about locking is naively wrong, too. Memory allocators which
are actually in widespread use have internal locks to guard against
concurrent acces by multiple processors. Even SMP-scalable allocators
like Hoard have locks. See, the problem is that even if you shunt
allocation requests into thread-local heaps, a piece of memory may be
freed by a different thread from the one which allocated it. Thread A
allocates an object, thread B frees it. So a lock on the heap has to be
acquired to re-insert the block into the free list.
== 12 of 16 ==
Date: Fri, Dec 25 2009 9:49 pm
From: Kaz Kylheku
On 2009-12-25, Branimir Maksimovic <bmaxa@hotmail.com> wrote:
> James Kanze wrote:
>> On Dec 24, 10:11 am, Branimir Maksimovic <bm...@hotmail.com> wrote:
>>> tanix wrote:
>>>> In article <hguelj$k4...@news.albasani.net>, Branimir Maksimovic <bm...@hotmail.com> wrote:
>>
>> [...]
>>> Memory managment is not a problem. You can implement GC, for
>>> any apllication even in assembler. Reference counting is
>>> simple form of gc and works well in c++ because of RAII.
>>
>> Reference counting doesn't work in C++, because of cycles. And
>> reference counting is very, very slow compared to the better
>> garbage collector algorithms.
>>
> Hm, have you ever head cycles? In my long experience I never
> had cyclic references...
> Reference counting can;t be slow because it does not have
> to lock all threads
Reference counting blocks the calling thread on an atomic increment
or decrement operation whenever the reference count must be manipulated.
Reference counting generates bus traffic. Whenever a refcount field is
written, the corresponding cache line is now dirty on the local
processor and must be updated to the other processors.
Refcounting forces garbage objects to be visited one by one before they
are reclaimed, in a random order, and possibly more than once! An object
with refcount 42 will in general be visited 42 times before 42
references can be dropped.
Someone recently remarked in the comp.lang.lisp newsgroup that a
a particular historic Lisp implementation, which used reference counting
rather than real GC, sometimes fell into such a long pause in
processing a dropped reference that frustrated programmers would just
reboot the system!!!
See when you drop a refcount on an object and it reaches zero, you are
not done. That object has pointers to other objects, and /their/
references have to be dropped. Refcounting does not eliminate the
fact that a graph is being walked.
But reference counting is the dumbest, slowest way of hunting down garbage.
== 13 of 16 ==
Date: Fri, Dec 25 2009 9:51 pm
From: Kaz Kylheku
On 2009-12-25, tanix <tanix@mongo.net> wrote:
> In article <hh3dco$osh$1@news.albasani.net>, Branimir Maksimovic <bmaxa@hotmail.com> wrote:
> Looks like it is a matter of life and death to you.
> But I doubt you can win this argument.
I doubt you can convince this village bohunk that he can possibly
lose an argument.
== 14 of 16 ==
Date: Fri, Dec 25 2009 10:04 pm
From: Branimir Maksimovic
Kaz Kylheku wrote:
> On 2009-12-25, Branimir Maksimovic <bmaxa@hotmail.com> wrote:
>> James Kanze wrote:
>>> On Dec 23, 11:21 pm, Branimir Maksimovic <bm...@hotmail.com> wrote:
>>>> tanix wrote:
>>>>> In article <hgskgk$kc...@news.albasani.net>, Vladimir Jovic <vladasp...@gmail.com> wrote:
>>>>> C++ would probably be benefited tremendously if it adopted some
>>>>> of the central Java concept, such as GC, threads and GUI.
>>>> GC is heavy performance killer especially on multiprocessor systems
>>>> in combination with threads....it is slow, complex and inefficient...
>>> Obviously, you've never actually measured. A lot depends on the
>>> application, but typically, C++ with garbage collection runs
>>> slightly faster than C++ without garbage collection. Especially
>>> in a multi-threaded envirionment,
>> How that can possibly be?
>
> How it can be is that surprising truths in the world don't take a pause
> so that morons can catch up.
>
>> GC kills all threads when it has
>> to collect?
>
> Big news: stopping threads using the scheduler is more efficient than
> throwing locks or atomic instructions in their execution path.
>
Well, stopping threads by using scheduler or any other means
while they work is same or worse as throwing locks or atomic
instructions in excetion path....
Actually this is I said already. Simplest way to perform garbage
collection is to pause program scan references then continue program...
> What's more efficient: pausing a thread once in a long while, or having
> it constantly trip over some atomic increment or decrement, possibly
> millions of times a second?
Atomic increment/ decrement costs nothing if nothing is locked....
So there is actually small probability that that will happen
because usually there are not many objects referenced from multiple
threads.
>
>> Or it can magically sweep through heap,stack,bss
>> etc and scan without locking all the time or stopping program?
>
> The job of GC is to find and reclaim unreachable objects.
Exactly.
>
> When an object becomes unreachable, it stays that way. A program does
> not lose a reference to an object, and then magically recover the
> reference. Thus, in general, garbage monotonically increases as
> computation proceeds.
>
> This means that GC can in fact proceed concurrently with the
> application.
Oonly after it finds unreferenced objects...
The only risk is that the program will generate more
> garbage while GC is running, which the GC will miss---objects which GC
> finds to be reachable became unreachable before it completes.
> But that's okay; they will be found next time.
So you will have 500 megabytes ram more used then with manual
deallocation.... ;)
>
> This is hinted at in the ``snapshot mark-and-sweep'' paragraph
> in the GC algorithms FAQ.
>
> http://www.iecc.com/gclist/GC-algorithms.html
>
>> Explain to me how?
>
> Go study garbage collection. There is lots of literature there.
>
> It's not a small, simple topic.
>
>> Manual deallocation does not have to lock at all....
>
> WTF are you stuipd?
Stupid?
>
> Firstly, any comparison between GC and manual deallocation is moronic.
Of course, manual deallocation does not have to pause
complete program...
>
> In order to invoke manual deallocation, the program has to be sure
> that the object is about to become unreachable, so that it does
> not prematurely delete an object that is still in use.
Hey. delete p just frees block of memory. That work is not that
complicated...
Moreover,
> the program has to also ensure that it eventually identifies all objects
> that are no longer in use. I.e. by the time it calls the function, the
> program has already done exactly the same the job that is done by the
> garbage collector: that of identifying garbage.
What are you talking about?
>
> /Both/ manual deallocation and garbage collection have to recycle
> objects somehow; the deallocation part is a subset of what GC does.
Yup. GC does much more deallocation part can be done concurrently.
That's why manual deallocation will always be more efficeint
and faster.
Look when I say free(p) it is just simple routine....
> (Garbage collectors integrated with C in fact call free on unreachable
> objects; so in that case it is obvious that the cost of /just/ the call
> to free is lower than the cost of hunting down garbage /and/ calling
> free on it!)
?
>
> The computation of an object lifetime is not cost free, whether it
> is done by the program, or farmed off to automatic garbage collection.
>
> Your point about locking is naively wrong, too. Memory allocators which
> are actually in widespread use have internal locks to guard against
> concurrent acces by multiple processors.
Of course.
Even SMP-scalable allocators
> like Hoard have locks.
Of course.
See, the problem is that even if you shunt
> allocation requests into thread-local heaps, a piece of memory may be
> freed by a different thread from the one which allocated it.
I have written such allocator...
Thread A
> allocates an object, thread B frees it. So a lock on the heap has to be
> acquired to re-insert the block into the free list.
Lock operation is very short and collision between two thread may pause
one or two threads. But other will continue to work. unlike with
gc which will completely pause program for sure.
Greets!
== 15 of 16 ==
Date: Fri, Dec 25 2009 10:17 pm
From: Branimir Maksimovic
Kaz Kylheku wrote:
> On 2009-12-25, Branimir Maksimovic <bmaxa@hotmail.com> wrote:
>> James Kanze wrote:
>>> On Dec 24, 10:11 am, Branimir Maksimovic <bm...@hotmail.com> wrote:
>>>> tanix wrote:
>>>>> In article <hguelj$k4...@news.albasani.net>, Branimir Maksimovic <bm...@hotmail.com> wrote:
>>> [...]
>>>> Memory managment is not a problem. You can implement GC, for
>>>> any apllication even in assembler. Reference counting is
>>>> simple form of gc and works well in c++ because of RAII.
>>> Reference counting doesn't work in C++, because of cycles. And
>>> reference counting is very, very slow compared to the better
>>> garbage collector algorithms.
>>>
>> Hm, have you ever head cycles? In my long experience I never
>> had cyclic references...
>> Reference counting can;t be slow because it does not have
>> to lock all threads
>
> Reference counting blocks the calling thread on an atomic increment
> or decrement operation whenever the reference count must be manipulated.
Hm, it does block nothing, actually it can happen if two or more
threads share same object which is in practice rare case.
And in same time add/release references.
Actually typical scenario is auto_ptr not shared ptr when
one thread passes object to the other.
>
> Reference counting generates bus traffic. Whenever a refcount field is
> written, the corresponding cache line is now dirty on the local
> processor and must be updated to the other processors.
Reference counting generates much less bus traffic then stopping
program and scanning memory. In order for GC to reach pointers,
it must ensure that every pointer in application
is flushed in memory, which is ....much much worse then
reference counting... Actually scanning memory generates
bus traffic if scan area, is larger than cache, which
is usually case since real world application heap
is usually larger than available cache.
>
> Refcounting forces garbage objects to be visited one by one before they
> are reclaimed, in a random order, and possibly more than once! An object
> with refcount 42 will in general be visited 42 times before 42
> references can be dropped.
42 references , unlikely... If it had million references, we could
be worried, but 42;)
>
> Someone recently remarked in the comp.lang.lisp newsgroup that a
> a particular historic Lisp implementation, which used reference counting
> rather than real GC, sometimes fell into such a long pause in
> processing a dropped reference that frustrated programmers would just
> reboot the system!!!
Hm. Lisp? This is shared_ptr we talking about...
>
> See when you drop a refcount on an object and it reaches zero, you are
> not done. That object has pointers to other objects, and /their/
> references have to be dropped. Refcounting does not eliminate the
> fact that a graph is being walked.
You are wrong. shared_ptr's are usually used externally, auto_ptr's are
usually used internally. or simply new in constructor/delete
in destructor.
>
> But reference counting is the dumbest, slowest way of hunting down garbage.
?
Greets
--
http:/.........
== 16 of 16 ==
Date: Fri, Dec 25 2009 10:18 pm
From: Branimir Maksimovic
Kaz Kylheku wrote:
> On 2009-12-25, tanix <tanix@mongo.net> wrote:
>> In article <hh3dco$osh$1@news.albasani.net>, Branimir Maksimovic <bmaxa@hotmail.com> wrote:
>> Looks like it is a matter of life and death to you.
>> But I doubt you can win this argument.
>
> I doubt you can convince this village bohunk that he can possibly
> lose an argument.
Argument can be won by argument.
Greets
--
==============================================================================
TOPIC: String not printing data on next line despite \n in the string
http://groups.google.com/group/comp.lang.c++/t/35658d761ffe5130?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Dec 25 2009 4:25 pm
From: "BGB / cr88192"
"Paavo Helde" <myfirstname@osa.pri.ee> wrote in message
news:Xns9CEBD26804A1Epaavo256@216.196.109.131...
> SRK <kumarsr@gmail.com> wrote in news:f45f3f70-d140-4b48-af0a-
> 10f52eee8394@15g2000prz.googlegroups.com:
>
>> Hi folks,
>> I am trying to read some data from a config file and want that data to
>> be printed in formatted way foe example if I have this string in the
>> config file - ABC PQR XYZ and want to display it like
>>
>> ABC
>> PQR
>> XYZ
>>
>> for that I have put the above mentioned string as ABC \nPQR \nXYZ
>>
>> But instead of displaying the next string on next line, when I print
>> the data, it prints as ABC \nPQR \nXYZ.
>
> You need to convert two symbols (backslash and n) to a single symbol
> (line-feed '\n').
>
> If this is not very performance-critical, you can do it in-place:
>
> std::string s = "ABC\\nPQR\\nXYZ\\n"; // contains backslash and n
>
> std::string::size_type k = 0;
> while((k=s.find("\\n", k))!=s.npos) {
> s.replace(k, 2, "\n");
> }
>
> // s now contains linefeed characters instead.
>
or, maybe the good old char-pointers strategy:
char tb[256]; //or whatever is the maximum sane length
char *s, *t;
s=input; t=tb;
while(*s)
{
if((*s=='\\') && (*(s+1)=='n'))
{ *t++='\n'; s+=2; continue; }
*t++=*s++;
}
*t++=0;
granted, one can debate whether or not this is good style in C++, ... but,
should work ok.
==============================================================================
TOPIC: C++ jobs down another 40%
http://groups.google.com/group/comp.lang.c++/t/6718a9cd2f3ecdbf?hl=en
==============================================================================
== 1 of 8 ==
Date: Fri, Dec 25 2009 4:45 pm
From: "BGB / cr88192"
"tanix" <tanix@mongo.net> wrote in message
news:hh330u$82i$4@news.eternal-september.org...
> In article <ItSdnThEINvlcqnWnZ2dnUVZ8qZi4p2d@brightview.co.uk>, Jon Harrop
> <jon@ffconsultancy.com> wrote:
>>James Kanze wrote:
>>> On Dec 23, 11:02 pm, red floyd <redfl...@gmail.com> wrote:
>>>> On Dec 23, 12:50 pm, Jon Harrop <j...@ffconsultancy.com> wrote:
>>>> > The number of job adverts in the UK citing C++ has fallen
>>>> > 40% for the second year in a row:
>>>
>>>> Hey, Jon! Wha'ts the market for F# jobs like?
>>>
>>> There is one, albeit not as big as that for C++.
>>>
>>> In practice, if you look at long term trends (and not short
>>> swings), C++ is pretty safe for the future.
>>
>>Are you saying that four years of rapid decline is a "short term swing"
>>and
>>not a "long term trend"?
>
> Well, you have to put things in perspective.
> Just taking C++ as some isolated case is not correct.
> The same thing is happening to Java, at least from the traffic
> I am seeing and that traffic is generated by mostly professional
> programmers from every single leading sw house or every single
> biggest and baddest enterprise for that matter.
>
> From what I see, the decay in non dynamically scoped languages
> largely comes from the fact that other languages can fulfill
> the requirements in more and more situations.
>
"dynamically typed" is the correct term here. "dynamically scoped" means
something different which, no, most of these languages don't do (lexical
scope being far more common).
> More and more of sw engineering is web related nowadays,
> or information related. Just the fact that Google got so arrogant
> as to challenge the Microsoft in their stronghold, the O/S
> business by trying to obliterate the very concept of O/S as
> something being inherently necessary in your box, says more
> about it than anything else.
>
> To challange WHO? Nothing less than Microsoft?
> And in their MAIN game? What does it tell you?
>
that google is in for a cold shower once people, in general, come to realize
what it is they are looking at...
granted, a lot is done on the internet, but I personally would not give up
on using a real computer with a real OS. even though I have and use a
netbook, what is more notable than this is that I run a full-featured Linux
on the thing (Ubuntu), rather than the shipped gimped distro (Xandros).
in the same way, I would not likely consider something like Chrome unless it
were at least as capable as a full Linux distro (even if I have noted that
the thing is too slow to really build or run any of my major projects on).
> --
> Programmer's Goldmine collections:
>
> http://preciseinfo.org
>
> Tens of thousands of code examples and expert discussions on
> C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript,
> organized by major topics of language, tools, methods, techniques.
>
== 2 of 8 ==
Date: Fri, Dec 25 2009 5:03 pm
From: "BGB / cr88192"
"Chris M. Thomasson" <no@spam.invalid> wrote in message
news:xR9Zm.3013$8e4.2445@newsfe03.iad...
> "tanix" <tanix@mongo.net> wrote in message
> news:hh31vk$82i$1@news.eternal-september.org...
>> In article
>> <66e7b0f7-4c71-4db4-a9f1-3f9d7e4dc5a5@a32g2000yqm.googlegroups.com>,
>> James
>> Kanze <james.kanze@gmail.com> wrote:
>>>On Dec 23, 11:02 pm, red floyd <redfl...@gmail.com> wrote:
>>>> On Dec 23, 12:50 pm, Jon Harrop <j...@ffconsultancy.com> wrote:
>>>
>>>> > The number of job adverts in the UK citing C++ has fallen
>>>> > 40% for the second year in a row:
>>>
>>>> Hey, Jon! Wha'ts the market for F# jobs like?
> [...]
>>
>> Well, I just looked at it on Wikipedia:
>> http://en.wikipedia.org/wiki/F_Sharp_%28programming_language%29
>>
>> Looks like another bluff to me. All sorts of bells and whistles.
>> For me, personally, it is a no go, and primarlily because it is
>> based on .net framework.
>
> FWIW, here is a fairly portable C# and CLR implementation:
>
> http://www.mono-project.com
>
yep, in my case, I acknowledge that mono exists.
looking deeper into the project though, I am personally a little less
compelled:
it is, IMO, poorly architected and built on terrible code (and terrible
coding practices).
granted, nothing is perfect.
in general, I like C# though, as for the most part it seems a fairly cleanly
designed language (apart from that it seems to need some level of "black
magic" to be able to parse).
I am a little more hesitant about the rest of the .NET framework though, and
would rather it was something capable of being statically compiled and
operated standalone.
little in the language particularly prohibits this, only that I am not aware
of any standalone C# implementation.
it is, at the moment, a little easier to write standalone Java, since there
is both GCJ, and JBC is simple enough as to make it not particularly
difficult to trans-compile to C or ASM (I have done so in the past in my
case). although, I don't presently like my current "ABI", but attempts to
design a newer/more efficient ABI ran into a few issues.
or such...
== 3 of 8 ==
Date: Fri, Dec 25 2009 5:04 pm
From: tanix@mongo.net (tanix)
In article <hh3mbs$6b8$1@news.albasani.net>, "BGB / cr88192" <cr88192@hotmail.com> wrote:
>
>"tanix" <tanix@mongo.net> wrote in message
>news:hh330u$82i$4@news.eternal-september.org...
>> In article <ItSdnThEINvlcqnWnZ2dnUVZ8qZi4p2d@brightview.co.uk>, Jon Harrop
>> <jon@ffconsultancy.com> wrote:
>>>James Kanze wrote:
>>>> On Dec 23, 11:02 pm, red floyd <redfl...@gmail.com> wrote:
>>>>> On Dec 23, 12:50 pm, Jon Harrop <j...@ffconsultancy.com> wrote:
>>>>> > The number of job adverts in the UK citing C++ has fallen
>>>>> > 40% for the second year in a row:
>>>>
>>>>> Hey, Jon! Wha'ts the market for F# jobs like?
>>>>
>>>> There is one, albeit not as big as that for C++.
>>>>
>>>> In practice, if you look at long term trends (and not short
>>>> swings), C++ is pretty safe for the future.
>>>
>>>Are you saying that four years of rapid decline is a "short term swing"
>>>and
>>>not a "long term trend"?
>>
>> Well, you have to put things in perspective.
>> Just taking C++ as some isolated case is not correct.
>> The same thing is happening to Java, at least from the traffic
>> I am seeing and that traffic is generated by mostly professional
>> programmers from every single leading sw house or every single
>> biggest and baddest enterprise for that matter.
>>
>> From what I see, the decay in non dynamically scoped languages
>> largely comes from the fact that other languages can fulfill
>> the requirements in more and more situations.
>"dynamically typed" is the correct term here. "dynamically scoped" means
>something different which, no, most of these languages don't do (lexical
>scope being far more common).
>> More and more of sw engineering is web related nowadays,
>> or information related. Just the fact that Google got so arrogant
>> as to challenge the Microsoft in their stronghold, the O/S
>> business by trying to obliterate the very concept of O/S as
>> something being inherently necessary in your box, says more
>> about it than anything else.
>>
>> To challange WHO? Nothing less than Microsoft?
>> And in their MAIN game? What does it tell you?
>that google is in for a cold shower once people, in general, come to realize
>what it is they are looking at...
You can not imagine how much would I like to see THAT show. :--}
>granted, a lot is done on the internet, but I personally would not give up
>on using a real computer with a real OS.
I would not even DREAM of such a think even if Google paid me
trice as much as my box is worth and for so many reasons, that I could
write a book about it. EASILY. You know my writing style by now, right?
:--}
> even though I have and use a
>netbook, what is more notable than this is that I run a full-featured Linux
>on the thing (Ubuntu), rather than the shipped gimped distro (Xandros).
Actually, I do like Ubuntu quite a bit.
It was a breath of fresh air for a couple of months
after my win box was rooted and I simply could not use it.
It is almost there. In fat it IS there, and for all I do,
I could easily switch to it without loosing a thing.
Except JVM under Linux runs about 2 times as slow for what I do.
Have no idea why. Sounds a bit weird to me.
Seconly, I can not run my monitoring firewall on it,
which is a total show stopper.
And finally, I do not like the NetBeans and Eclipse that much.
Pretty clumzy stuff, I'd say. Plus horrible code completion
functionality. Too convoluted everything.
The way I have it right now is a breeze for me.
But, as soon as I see a real good IDE, which could already
be there, except I did not see it, and I see my JVM running
as fast, I'd be willing to totally switch even before I
rewrite the firewall driver. The program code should be easy
to port. But the network driver interface could be a major
pain. I do need an equivalent of NDIS intermediate device
driver that sits as the lowest thing on the stack, just
above the netowork card driver.
I am WAY too fed up with this windows trip.
The most unstable thing in the world, even compared with pub domain
Linux.
>in the same way, I would not likely consider something like Chrome unless it
>were at least as capable as a full Linux distro (even if I have noted that
>the thing is too slow to really build or run any of my major projects on).
I am not even reading any of that hype.
First of all, I am not going to switch anything, especially on the O/S
level, until it had at least 2 years to run and most nasty things
are fixed.
Secondly, considering the fact that microsoft is in the game since
yearly eighties and have megatons of stuff developed, just to
go with some arrogant, greedy out of their mind monsters, and quite
literally at that, would be not only suicidal but outright stupid.
And I did have to deal with them on a much closer basis than
most people. Probably the most disgusting feeling I ever had.
"I don't care" lessness is at stratospheric level.
--
Programmer's Goldmine collections:
Tens of thousands of code examples and expert discussions on
C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript,
organized by major topics of language, tools, methods, techniques.
== 4 of 8 ==
Date: Fri, Dec 25 2009 5:12 pm
From: tanix@mongo.net (tanix)
In article <hh3ne4$7k2$1@news.albasani.net>, "BGB / cr88192" <cr88192@hotmail.com> wrote:
>
>"Chris M. Thomasson" <no@spam.invalid> wrote in message
>news:xR9Zm.3013$8e4.2445@newsfe03.iad...
>> "tanix" <tanix@mongo.net> wrote in message
>> news:hh31vk$82i$1@news.eternal-september.org...
>>> In article
>>> <66e7b0f7-4c71-4db4-a9f1-3f9d7e4dc5a5@a32g2000yqm.googlegroups.com>,
>>> James
>>> Kanze <james.kanze@gmail.com> wrote:
>>>>On Dec 23, 11:02 pm, red floyd <redfl...@gmail.com> wrote:
>>>>> On Dec 23, 12:50 pm, Jon Harrop <j...@ffconsultancy.com> wrote:
>>>>
>>>>> > The number of job adverts in the UK citing C++ has fallen
>>>>> > 40% for the second year in a row:
>>>>
>>>>> Hey, Jon! Wha'ts the market for F# jobs like?
>> [...]
>>>
>>> Well, I just looked at it on Wikipedia:
>>> http://en.wikipedia.org/wiki/F_Sharp_%28programming_language%29
>>>
>>> Looks like another bluff to me. All sorts of bells and whistles.
>>> For me, personally, it is a no go, and primarlily because it is
>>> based on .net framework.
>>
>> FWIW, here is a fairly portable C# and CLR implementation:
>>
>> http://www.mono-project.com
>>
>
>yep, in my case, I acknowledge that mono exists.
>looking deeper into the project though, I am personally a little less
>compelled:
>it is, IMO, poorly architected and built on terrible code (and terrible
>coding practices).
Uggh. That one is going to wait then.
>granted, nothing is perfect.
>
>in general, I like C# though, as for the most part it seems a fairly cleanly
>designed language (apart from that it seems to need some level of "black
>magic" to be able to parse).
>
>I am a little more hesitant about the rest of the .NET framework though, and
>would rather it was something capable of being statically compiled and
>operated standalone.
I just looked at some of it in passing.
Looks like some kind of equivalent of JVM underneeth.
A single fact that you need to agree with something to even
have your app to run under it, is a total no go for me.
You can not even deliver your J# app as a single executable
is simply berzerk. And now, you can not even compile Java
starting with VC 2008 and higher. Disaster.
>little in the language particularly prohibits this, only that I am not aware
>of any standalone C# implementation.
>it is, at the moment, a little easier to write standalone Java, since there
>is both GCJ, and JBC is simple enough as to make it not particularly
>difficult to trans-compile to C or ASM
Oh, interesting. Is there a way to generate Java code out
of C++/MFC by any chance?
>(I have done so in the past in my
>case). although, I don't presently like my current "ABI", but attempts to
>design a newer/more efficient ABI ran into a few issues.
>or such...
--
Programmer's Goldmine collections:
Tens of thousands of code examples and expert discussions on
C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript,
organized by major topics of language, tools, methods, techniques.
== 5 of 8 ==
Date: Fri, Dec 25 2009 5:18 pm
From: "BGB / cr88192"
"tanix" <tanix@mongo.net> wrote in message
news:hh3ne1$14q$1@news.eternal-september.org...
> In article <hh3mbs$6b8$1@news.albasani.net>, "BGB / cr88192"
> <cr88192@hotmail.com> wrote:
>>
>>"tanix" <tanix@mongo.net> wrote in message
>>news:hh330u$82i$4@news.eternal-september.org...
>>> In article <ItSdnThEINvlcqnWnZ2dnUVZ8qZi4p2d@brightview.co.uk>, Jon
>>> Harrop
>>> <jon@ffconsultancy.com> wrote:
>>>>James Kanze wrote:
>>>>> On Dec 23, 11:02 pm, red floyd <redfl...@gmail.com> wrote:
>>>>>> On Dec 23, 12:50 pm, Jon Harrop <j...@ffconsultancy.com> wrote:
>>>>>> > The number of job adverts in the UK citing C++ has fallen
>>>>>> > 40% for the second year in a row:
>>>>>
>>>>>> Hey, Jon! Wha'ts the market for F# jobs like?
>>>>>
>>>>> There is one, albeit not as big as that for C++.
>>>>>
>>>>> In practice, if you look at long term trends (and not short
>>>>> swings), C++ is pretty safe for the future.
>>>>
>>>>Are you saying that four years of rapid decline is a "short term swing"
>>>>and
>>>>not a "long term trend"?
>>>
>>> Well, you have to put things in perspective.
>>> Just taking C++ as some isolated case is not correct.
>>> The same thing is happening to Java, at least from the traffic
>>> I am seeing and that traffic is generated by mostly professional
>>> programmers from every single leading sw house or every single
>>> biggest and baddest enterprise for that matter.
>>>
>>> From what I see, the decay in non dynamically scoped languages
>>> largely comes from the fact that other languages can fulfill
>>> the requirements in more and more situations.
>
>>"dynamically typed" is the correct term here. "dynamically scoped" means
>>something different which, no, most of these languages don't do (lexical
>>scope being far more common).
>
>>> More and more of sw engineering is web related nowadays,
>>> or information related. Just the fact that Google got so arrogant
>>> as to challenge the Microsoft in their stronghold, the O/S
>>> business by trying to obliterate the very concept of O/S as
>>> something being inherently necessary in your box, says more
>>> about it than anything else.
>>>
>>> To challange WHO? Nothing less than Microsoft?
>>> And in their MAIN game? What does it tell you?
>
>>that google is in for a cold shower once people, in general, come to
>>realize
>>what it is they are looking at...
>
> You can not imagine how much would I like to see THAT show. :--}
>
it was metaphorical.
>>granted, a lot is done on the internet, but I personally would not give up
>>on using a real computer with a real OS.
>
> I would not even DREAM of such a think even if Google paid me
> trice as much as my box is worth and for so many reasons, that I could
> write a book about it. EASILY. You know my writing style by now, right?
> :--}
>
I don't follow.
>> even though I have and use a
>>netbook, what is more notable than this is that I run a full-featured
>>Linux
>>on the thing (Ubuntu), rather than the shipped gimped distro (Xandros).
>
> Actually, I do like Ubuntu quite a bit.
> It was a breath of fresh air for a couple of months
> after my win box was rooted and I simply could not use it.
>
> It is almost there. In fat it IS there, and for all I do,
> I could easily switch to it without loosing a thing.
>
yeah...
I still mostly use Windows, even though there is not a whole lot keeping me
there.
mostly I do so, since a larger potential userbase exists on Windows.
sadly, my project has been having MS-style technologies gradually creep in,
but nothing which would particularly hurt portability (only stuff which
would seem slightly "odd" on Linux...).
> Except JVM under Linux runs about 2 times as slow for what I do.
> Have no idea why. Sounds a bit weird to me.
>
> Seconly, I can not run my monitoring firewall on it,
> which is a total show stopper.
>
> And finally, I do not like the NetBeans and Eclipse that much.
> Pretty clumzy stuff, I'd say. Plus horrible code completion
> functionality. Too convoluted everything.
>
> The way I have it right now is a breeze for me.
>
> But, as soon as I see a real good IDE, which could already
> be there, except I did not see it, and I see my JVM running
> as fast, I'd be willing to totally switch even before I
> rewrite the firewall driver. The program code should be easy
> to port. But the network driver interface could be a major
> pain. I do need an equivalent of NDIS intermediate device
> driver that sits as the lowest thing on the stack, just
> above the netowork card driver.
>
> I am WAY too fed up with this windows trip.
> The most unstable thing in the world, even compared with pub domain
> Linux.
>
I don't exactly do whole lots of Java development, and what little I have
done has not been for a "proper" JVM anyways. (some minor stuff for a
mockup/mini VM within my own projects).
so, alas, not much comment here.
>>in the same way, I would not likely consider something like Chrome unless
>>it
>>were at least as capable as a full Linux distro (even if I have noted that
>>the thing is too slow to really build or run any of my major projects on).
>
> I am not even reading any of that hype.
> First of all, I am not going to switch anything, especially on the O/S
> level, until it had at least 2 years to run and most nasty things
> are fixed.
>
> Secondly, considering the fact that microsoft is in the game since
> yearly eighties and have megatons of stuff developed, just to
> go with some arrogant, greedy out of their mind monsters, and quite
> literally at that, would be not only suicidal but outright stupid.
> And I did have to deal with them on a much closer basis than
> most people. Probably the most disgusting feeling I ever had.
> "I don't care" lessness is at stratospheric level.
>
ok.
> --
> Programmer's Goldmine collections:
>
> http://preciseinfo.org
>
> Tens of thousands of code examples and expert discussions on
> C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript,
> organized by major topics of language, tools, methods, techniques.
>
== 6 of 8 ==
Date: Fri, Dec 25 2009 5:43 pm
From: tanix@mongo.net (tanix)
In article <hh3o9a$8m1$1@news.albasani.net>, "BGB / cr88192" <cr88192@hotmail.com> wrote:
>
>"tanix" <tanix@mongo.net> wrote in message
>news:hh3ne1$14q$1@news.eternal-september.org...
>> In article <hh3mbs$6b8$1@news.albasani.net>, "BGB / cr88192"
>> <cr88192@hotmail.com> wrote:
>>>
>>>"tanix" <tanix@mongo.net> wrote in message
>>>news:hh330u$82i$4@news.eternal-september.org...
>>>> In article <ItSdnThEINvlcqnWnZ2dnUVZ8qZi4p2d@brightview.co.uk>, Jon
>>>> Harrop
>>>> <jon@ffconsultancy.com> wrote:
>>>>>James Kanze wrote:
>>>>>> On Dec 23, 11:02 pm, red floyd <redfl...@gmail.com> wrote:
>>>>>>> On Dec 23, 12:50 pm, Jon Harrop <j...@ffconsultancy.com> wrote:
>>>>>>> > The number of job adverts in the UK citing C++ has fallen
>>>>>>> > 40% for the second year in a row:
>>>>>>
>>>>>>> Hey, Jon! Wha'ts the market for F# jobs like?
>>>>>>
>>>>>> There is one, albeit not as big as that for C++.
>>>>>>
>>>>>> In practice, if you look at long term trends (and not short
>>>>>> swings), C++ is pretty safe for the future.
>>>>>
>>>>>Are you saying that four years of rapid decline is a "short term swing"
>>>>>and
>>>>>not a "long term trend"?
>>>>
>>>> Well, you have to put things in perspective.
>>>> Just taking C++ as some isolated case is not correct.
>>>> The same thing is happening to Java, at least from the traffic
>>>> I am seeing and that traffic is generated by mostly professional
>>>> programmers from every single leading sw house or every single
>>>> biggest and baddest enterprise for that matter.
>>>>
>>>> From what I see, the decay in non dynamically scoped languages
>>>> largely comes from the fact that other languages can fulfill
>>>> the requirements in more and more situations.
>>
>>>"dynamically typed" is the correct term here. "dynamically scoped" means
>>>something different which, no, most of these languages don't do (lexical
>>>scope being far more common).
>>
>>>> More and more of sw engineering is web related nowadays,
>>>> or information related. Just the fact that Google got so arrogant
>>>> as to challenge the Microsoft in their stronghold, the O/S
>>>> business by trying to obliterate the very concept of O/S as
>>>> something being inherently necessary in your box, says more
>>>> about it than anything else.
>>>>
>>>> To challange WHO? Nothing less than Microsoft?
>>>> And in their MAIN game? What does it tell you?
>>
>>>that google is in for a cold shower once people, in general, come to
>>>realize
>>>what it is they are looking at...
>>
>> You can not imagine how much would I like to see THAT show. :--}
>>
>it was metaphorical.
>
>>>granted, a lot is done on the internet, but I personally would not give up
>>>on using a real computer with a real OS.
>>
>> I would not even DREAM of such a think even if Google paid me
>> trice as much as my box is worth and for so many reasons, that I could
>> write a book about it. EASILY. You know my writing style by now, right?
>> :--}
>I don't follow.
I mean google trying to get into O/S business essentially.
I don't know much about it, but some time ago I have heard
that Google wants to go for Microsoft's throat in the O/S business.
Not that I would pay any attention to this kind of arrogance.
Google got so arrogant and obnoxious with ther "suck-cess" trip,
that they seem to even think: hey, what is miscrosoft?
Lets bully them out of the market with our horns.
And from what I have seen, they really think they've got some
"ace" card to do it with.
They want nothing less then "revolution" in computing!!!
Brrrrrr.
>>> even though I have and use a
>>>netbook, what is more notable than this is that I run a full-featured
>>>Linux
>>>on the thing (Ubuntu), rather than the shipped gimped distro (Xandros).
>>
>> Actually, I do like Ubuntu quite a bit.
>> It was a breath of fresh air for a couple of months
>> after my win box was rooted and I simply could not use it.
>>
>> It is almost there. In fat it IS there, and for all I do,
>> I could easily switch to it without loosing a thing.
>>
>
>yeah...
>
>I still mostly use Windows, even though there is not a whole lot keeping me
>there.
>mostly I do so, since a larger potential userbase exists on Windows.
>sadly, my project has been having MS-style technologies gradually creep in,
>but nothing which would particularly hurt portability (only stuff which
>would seem slightly "odd" on Linux...).
>
>> Except JVM under Linux runs about 2 times as slow for what I do.
>> Have no idea why. Sounds a bit weird to me.
>>
>> Seconly, I can not run my monitoring firewall on it,
>> which is a total show stopper.
>>
>> And finally, I do not like the NetBeans and Eclipse that much.
>> Pretty clumzy stuff, I'd say. Plus horrible code completion
>> functionality. Too convoluted everything.
>>
>> The way I have it right now is a breeze for me.
>>
>> But, as soon as I see a real good IDE, which could already
>> be there, except I did not see it, and I see my JVM running
>> as fast, I'd be willing to totally switch even before I
>> rewrite the firewall driver. The program code should be easy
>> to port. But the network driver interface could be a major
>> pain. I do need an equivalent of NDIS intermediate device
>> driver that sits as the lowest thing on the stack, just
>> above the netowork card driver.
>>
>> I am WAY too fed up with this windows trip.
>> The most unstable thing in the world, even compared with pub domain
>> Linux.
>>
>
>I don't exactly do whole lots of Java development, and what little I have
>done has not been for a "proper" JVM anyways. (some minor stuff for a
>mockup/mini VM within my own projects).
>
>so, alas, not much comment here.
>
>
>>>in the same way, I would not likely consider something like Chrome unless
>>>it
>>>were at least as capable as a full Linux distro (even if I have noted that
>>>the thing is too slow to really build or run any of my major projects on).
>>
>> I am not even reading any of that hype.
>> First of all, I am not going to switch anything, especially on the O/S
>> level, until it had at least 2 years to run and most nasty things
>> are fixed.
>>
>> Secondly, considering the fact that microsoft is in the game since
>> yearly eighties and have megatons of stuff developed, just to
>> go with some arrogant, greedy out of their mind monsters, and quite
>> literally at that, would be not only suicidal but outright stupid.
>> And I did have to deal with them on a much closer basis than
>> most people. Probably the most disgusting feeling I ever had.
>> "I don't care" lessness is at stratospheric level.
>>
>ok.
--
Programmer's Goldmine collections:
Tens of thousands of code examples and expert discussions on
C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript,
organized by major topics of language, tools, methods, techniques.
== 7 of 8 ==
Date: Fri, Dec 25 2009 10:40 pm
From: "BGB / cr88192"
"tanix" <tanix@mongo.net> wrote in message
news:hh3pnl$8of$1@news.eternal-september.org...
> In article <hh3o9a$8m1$1@news.albasani.net>, "BGB / cr88192"
> <cr88192@hotmail.com> wrote:
>>
>>"tanix" <tanix@mongo.net> wrote in message
>>news:hh3ne1$14q$1@news.eternal-september.org...
>>> In article <hh3mbs$6b8$1@news.albasani.net>, "BGB / cr88192"
>>> <cr88192@hotmail.com> wrote:
>>>>
>>>>"tanix" <tanix@mongo.net> wrote in message
>>>>news:hh330u$82i$4@news.eternal-september.org...
>>>>> In article <ItSdnThEINvlcqnWnZ2dnUVZ8qZi4p2d@brightview.co.uk>, Jon
>>>>> Harrop
>>>>> <jon@ffconsultancy.com> wrote:
>>>>>>James Kanze wrote:
>>>>>>> On Dec 23, 11:02 pm, red floyd <redfl...@gmail.com> wrote:
>>>>>>>> On Dec 23, 12:50 pm, Jon Harrop <j...@ffconsultancy.com> wrote:
>>>>>>>> > The number of job adverts in the UK citing C++ has fallen
>>>>>>>> > 40% for the second year in a row:
>>>>>>>
>>>>>>>> Hey, Jon! Wha'ts the market for F# jobs like?
>>>>>>>
>>>>>>> There is one, albeit not as big as that for C++.
>>>>>>>
>>>>>>> In practice, if you look at long term trends (and not short
>>>>>>> swings), C++ is pretty safe for the future.
>>>>>>
>>>>>>Are you saying that four years of rapid decline is a "short term
>>>>>>swing"
>>>>>>and
>>>>>>not a "long term trend"?
>>>>>
>>>>> Well, you have to put things in perspective.
>>>>> Just taking C++ as some isolated case is not correct.
>>>>> The same thing is happening to Java, at least from the traffic
>>>>> I am seeing and that traffic is generated by mostly professional
>>>>> programmers from every single leading sw house or every single
>>>>> biggest and baddest enterprise for that matter.
>>>>>
>>>>> From what I see, the decay in non dynamically scoped languages
>>>>> largely comes from the fact that other languages can fulfill
>>>>> the requirements in more and more situations.
>>>
>>>>"dynamically typed" is the correct term here. "dynamically scoped" means
>>>>something different which, no, most of these languages don't do (lexical
>>>>scope being far more common).
>>>
>>>>> More and more of sw engineering is web related nowadays,
>>>>> or information related. Just the fact that Google got so arrogant
>>>>> as to challenge the Microsoft in their stronghold, the O/S
>>>>> business by trying to obliterate the very concept of O/S as
>>>>> something being inherently necessary in your box, says more
>>>>> about it than anything else.
>>>>>
>>>>> To challange WHO? Nothing less than Microsoft?
>>>>> And in their MAIN game? What does it tell you?
>>>
>>>>that google is in for a cold shower once people, in general, come to
>>>>realize
>>>>what it is they are looking at...
>>>
>>> You can not imagine how much would I like to see THAT show. :--}
>>>
>>it was metaphorical.
>>
>>>>granted, a lot is done on the internet, but I personally would not give
>>>>up
>>>>on using a real computer with a real OS.
>>>
>>> I would not even DREAM of such a think even if Google paid me
>>> trice as much as my box is worth and for so many reasons, that I could
>>> write a book about it. EASILY. You know my writing style by now, right?
>>> :--}
>
>>I don't follow.
>
> I mean google trying to get into O/S business essentially.
> I don't know much about it, but some time ago I have heard
> that Google wants to go for Microsoft's throat in the O/S business.
> Not that I would pay any attention to this kind of arrogance.
>
> Google got so arrogant and obnoxious with ther "suck-cess" trip,
> that they seem to even think: hey, what is miscrosoft?
> Lets bully them out of the market with our horns.
>
> And from what I have seen, they really think they've got some
> "ace" card to do it with.
>
> They want nothing less then "revolution" in computing!!!
> Brrrrrr.
>
what they are building hype for is, AFAICT, Linux -X11 +Chrome (the
browser).
I guess they are building a custom GUI based around the browser's UI, and
essentially the browser will be the main UI for the OS.
I guess the idea is that pretty much all software for the OS will be
streamed net applications (presumably apart from the kernel and browser,
which will be proprietary?...).
personally, the idea does not sound particularly appealing.
I would personally much rather see internet-related facilities better
integrated with the OS, while still allowing a more conventional development
model. this would be, for example, if the OS itself came with a good-quality
JavaScript engine (which played well with C), and maybe an HTTP-based
network filesystem which had something analogous to a web-cache (but less
crappy). in this way, full applications could be "pulled down" and run
locally (but, otherwise, packaged and put online).
then again, MS has half-assedly done some of this already (errm, only that I
have my doubts that they are good enough to be worth using...).
(using a funky API and/or having to mount a WebDav account as a local drive
letter is not ideal...).
I guess though having direct access to a web-backed cache via plain file IO
requests would just be too convinient though.
in the past, I had an HTTP client and server, but the code eventually broke
away and I never really bothered to revive it (not having any clear or solid
need for it thus far I guess...).
(actually, a lot of my network code broke up some-odd years back, when I had
at the time essentially redesigned my VFS system in a way which broke most
of my sockets-related code, since sockets were routed via the VFS API, which
I mostly redesigned as a cleanup effort).
recently, I had partially started work on re-implementing this, but didn't
really go much further (I have an x86+POSIX based interpreter which itself
has sockets, but they are purely "local" at present, since they were more
added for internal IPC and client/host communication than for
networking...).
<snip> (doesn't seem anything more was commented on, ok).
== 8 of 8 ==
Date: Fri, Dec 25 2009 11:58 pm
From: "BGB / cr88192"
"tanix" <tanix@mongo.net> wrote in message
news:hh3nuq$14q$2@news.eternal-september.org...
> In article <hh3ne4$7k2$1@news.albasani.net>, "BGB / cr88192"
> <cr88192@hotmail.com> wrote:
>>
>>"Chris M. Thomasson" <no@spam.invalid> wrote in message
>>news:xR9Zm.3013$8e4.2445@newsfe03.iad...
>>> "tanix" <tanix@mongo.net> wrote in message
>>> news:hh31vk$82i$1@news.eternal-september.org...
>>>> In article
>>>> <66e7b0f7-4c71-4db4-a9f1-3f9d7e4dc5a5@a32g2000yqm.googlegroups.com>,
>>>> James
>>>> Kanze <james.kanze@gmail.com> wrote:
>>>>>On Dec 23, 11:02 pm, red floyd <redfl...@gmail.com> wrote:
>>>>>> On Dec 23, 12:50 pm, Jon Harrop <j...@ffconsultancy.com> wrote:
>>>>>
>>>>>> > The number of job adverts in the UK citing C++ has fallen
>>>>>> > 40% for the second year in a row:
>>>>>
>>>>>> Hey, Jon! Wha'ts the market for F# jobs like?
>>> [...]
>>>>
>>>> Well, I just looked at it on Wikipedia:
>>>> http://en.wikipedia.org/wiki/F_Sharp_%28programming_language%29
>>>>
>>>> Looks like another bluff to me. All sorts of bells and whistles.
>>>> For me, personally, it is a no go, and primarlily because it is
>>>> based on .net framework.
>>>
>>> FWIW, here is a fairly portable C# and CLR implementation:
>>>
>>> http://www.mono-project.com
>>>
>>
>>yep, in my case, I acknowledge that mono exists.
>>looking deeper into the project though, I am personally a little less
>>compelled:
>>it is, IMO, poorly architected and built on terrible code (and terrible
>>coding practices).
>
> Uggh. That one is going to wait then.
>
well, I guess it is probably not so bad if:
one only really expects it to work on Linux, and uses MS's .NET on Windows;
makes sure to pretend (sort of) that they are coding on Windows, and stays
clear of Mono's extensions (mostly GTK bindings, glue into a bunch of GNome
related stuff, ...).
personally, I would have assumed making a new GUI API, which was generally
free of being tied to a particular OS-level GUI. I don't like the idea of
coding against a GTK wrapper, as personally I don't want to be tied to
having to use GTK.
but, this is not the end of it, as it is worth noting that Mono itself is
tied to GTK at a very fundamental level (IOW, a lot of the core VM code is
built on GTK's API functions, on GLib, ...).
I at first put some effort into trying to get it to build from sources on
Windows, but was having far too many difficulties, and personally found the
code a bit nasty, so quickly enough gave up.
I later started looking into writing my own .NET implementation, but this
petered out, as my frameworks' architecture started taking shape on its own,
but is not a whole lot like the .NET VM.
actually, my project is a lot more of a chimera (some parts influenced by
the JVM, others by .NET, others by GCC, others by LLVM, ...).
however, I think its only real advantage is that I personally feel the role
of the VM is different, and so there are many "philosophical" differences.
personally, I rather dislike monolithic architectures. and so, much of the
architecture is based around loosely coupled "modules" or "components", and
some effort is put into making these compoents too specific, even to each
other.
so, my beliefs here are that:
the world does not revolve around the VM, the VM framework should "assist"
the app, not "dominate" it;
it should be possible to use which parts are needed, and discard the rest
(or supply alterantive implementations, if this is needed);
the architecture should remain relatively open, as not to overly limit
possible use cases (consider if the VM is composed of lego blocks which can
be put together in different ways under the discretion of the frontend app);
the VM should also play well with pre-existing technologies (I have tried to
base many of the components after fairly "standard" pieces, and although
imperfect at times, it is possible to use "off the shelf" apps for many
purposes, both to provide input or accept output);
...
so, I am at odds with both .NET and the JVM on philosophical grounds;
and, I disagree with LLVM on architectural grounds (granted, I have a mess
here, but personally I just don't really like LLVM's architecture);
...
however, I have tried to minimize creating "novel" parts when possible.
sadly, some level of "novelty" and "internal dependencies" are inevitable it
seems...
thus far, much of the VM revolves around "good old C", both as the language
of implementation, and as the language of scripting. I have attempted to
move beyond C (Java and C# looked like good languages to try to add, and
JavaScript and Scheme also have some interest).
however, it is all a bit of a "trudging through mud" experience, and C
remains as the only really "usably complete" language in the mix (my C
compiler contains a few holes and failings, but for the most part it is
adequate).
but, ideally, an app will "use" a framework, rather than be "built on top
of" it, and it "should" be a component which can be integrated into a
project (or dropped again) without otherwise requiring significant
modification.
this is the ideal, although granted, it is much work to achieve these sorts
of ideals.
>>granted, nothing is perfect.
>>
>>in general, I like C# though, as for the most part it seems a fairly
>>cleanly
>>designed language (apart from that it seems to need some level of "black
>>magic" to be able to parse).
>>
>>I am a little more hesitant about the rest of the .NET framework though,
>>and
>>would rather it was something capable of being statically compiled and
>>operated standalone.
>
> I just looked at some of it in passing.
> Looks like some kind of equivalent of JVM underneeth.
>
C# is sort of like "Java's big brother" in terms of design. at its core,
they are in many ways fairly similar languages (just C# returns a little
closer to its C and C++ roots, re-adding many more features and
complexities...).
in a similar way, the .NET VM architecture is sort of like a "big brother"
to the JVM. there are many subtle aspects which are similar, but with one
notable and apparent difference:
.NET is FAR more complicated WRT its internal workings.
(the JVM has a few hairy bits, but in general it is "not that bad", and a
beating together a working basic implementation is a "reasonably" easily
achievable goal). well, apart from the persisting lack of a class library
(writing Java code in a vacuum is not nearly so compelling).
> A single fact that you need to agree with something to even
> have your app to run under it, is a total no go for me.
>
> You can not even deliver your J# app as a single executable
> is simply berzerk. And now, you can not even compile Java
> starting with VC 2008 and higher. Disaster.
>
yeah.
>>little in the language particularly prohibits this, only that I am not
>>aware
>>of any standalone C# implementation.
>
>>it is, at the moment, a little easier to write standalone Java, since
>>there
>>is both GCJ, and JBC is simple enough as to make it not particularly
>>difficult to trans-compile to C or ASM
>
> Oh, interesting. Is there a way to generate Java code out
> of C++/MFC by any chance?
>
"there be dragons there".
Java can be compiled to C without too much horror, since for the most part
JBC uses a clear subset of C's basic capabilities (although, the translation
is at a fairly low level of abstraction, for example, I operate "underneath"
the JVM's stack model, and essentially remap stack operations to local
variables via a kind of naive graph-conversion algo...).
I actually use a plain Java compiler to produce the class files, so that I
could them mostly focus on translating the bytecode to C.
however, C does not map nicely to the JVM (even in the simple case, it is
horridly inefficient, and even more horridly crappy), this much is not
likely worth the bother.
C++ -> Java, if possible, would likely be something too terrible to be
described.
x86 -> Java or JBC should be possible, but I doubt would be of much
practical use (likely poor efficiency, and the languages would not be able
to really relate or share data at a meaningful level). likewise for just
writing an x86 interpreter.
however, an interpreter would allow, potentially, compiling C++ code to x86,
loading the x86 in an interpreter and running it (at likely crap speeds),
...
is it worthwhile?... probably not.
it is worth noting that low-abstraction machine-code like representations
(including JBC and x86 machine code) are generally easier to translate and
manipulate effectively, whereas with higher-level forms (such as source
code), one can generally do a much better job and has far more "power".
however, JBC can be fairly faithfully converted to C (much easier than many
other possible paths), and does not tend to introduce all that many
"impedence" problems.
hence, it works acceptably to convert Java to C by first compiling to JBC
(AKA: class files), and then translating.
however, this does not extend to the general case, and is very specific to
various internal properties of both Java and JBC.
(although, granted, there are still a few sharp edges, but these are
managable).
for example, Java requires that the stack have exactly the same layout at
both the source and destination of a jump, and that the layout of the stack
is required to be constant at a given bytecode position.
the implications of these simple restrictions are notable and drastic, and
without these particular rules, doing an effective translation would have
been a much uglier problem (essentially requiring "simulation", rather than
a value-flow graph-based translation, ...).
just imaging here that every push and pop pushes or pops an abstract
variable, rather than a value, and so the sequence of stack-based operations
can be compared to putting down and picking up the ends of tubes and
plugging them into operations, and then putting down the result-tube, ...
the process, though naive, is elegantly simple, and can convert a method
from a sequence of stack operations, into a graph of interconnected
operations, which can then be (fairly straightforwardly) converted back into
C code.
none of this holds with either C, C++, or x86 machine code, OTOH, and hence
such a conversion is not directly possible as such.
or such...
==============================================================================
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:
Post a Comment