J
Juha Nieminen
Paul said:From behind which rock have you crawled?
Please explain to us how using a jump table to implement a switch block
of 525 cases could possibly take 1500 clock cycles.
Paul said:From behind which rock have you crawled?
I already have explained it, obviosly this is a very rough estimate
as not
all CPU's are the same. Can you explain how many clock cycles you think it'd
take?
Paul said:You can't have a switch statement with 525 cases executed in 6 clock cycles
you fucking moronic idiot.
[..]
Some examples of POD and non-POD types :
struct POD { int i; }; // Only POD members
struct NonPOD { int * p; }; // Pointer isn't POD
Really? No, REALLY?!! Any proof (quote from the Standard, a book or some
such)?
[..]
Now, am I mistaking anywhere ?
I don't know. I stopped reading after you called a pointer non-POD...
[..]
V
Paul said:I am not even talking about a jump table, what makes you think a jump table
has any relevance to what I said?
Le 14/08/2011 00:16, Victor Bazarov a écrit :[..]
Some examples of POD and non-POD types :
struct POD { int i; }; // Only POD members
struct NonPOD { int * p; }; // Pointer isn't POD
Really? No, REALLY?!! Any proof (quote from the Standard, a book or some
such)?
[..]
Now, am I mistaking anywhere ?
I don't know. I stopped reading after you called a pointer non-POD... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[..]
V
If you read the beginning before the code, you would have seen
" <<< Errors in, see after >>> " in my message, meaning that I knew I
was wrong.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^My message was composed of two parts, one written using my memory (and,
while I
was saying a pointer wasn't POD, I was pretty sure of that, but I was
wrong,
because, while pointers /often/ causes classes not to be POD,
it's indeed
the classic use of them that is in cause : delete ptr_ in the
destructor), which
had been corrupted by time without checking the definition (last time I
heard of
PODs was at least one year ago).
The second part (starting by BTW) was written [..]
So, maybe, even not reading the whole message, but at least the
beginning before the
end, would help you to understand the true message I posted.
Paul said:I made it clear that the estimated number of clock cycles was based on a
worse case scenario, where all conditions were checked.
Le 14/08/2011 00:16, Victor Bazarov a écrit : [...]
If you read the beginning before the code, you would have seen
" <<< Errors in, see after >>> " in my message, meaning that I knew I
was wrong.
Yes, if I read. I didn't. And I shouldn't have to.
If you knew that you
were wrong, delete the text before posting and type in the correct part.
Better yet, reconsider posting. I understand that you might have felt
that since you spent time typing it, it was somehow worth publishing (to
offset the expense of typing it up). It wasn't.
While you did waste time
(yours) typing nonsense, you wasted even more of it (mine and others')
by not removing the nonsense from your message before posting the whole
thing.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You keep doing that, don't you? Where do you get this nonsense? And if
you can't recognize it as nonsense, perhaps you should get into habit of
verifying everything that you're about to publish? Yes, we understand
that human memory is not perfect, but, man, if you know that yours is
especially vulnerable, stop relying on it.
it's indeed
the classic use of them that is in cause : delete ptr_ in the
destructor), which
had been corrupted by time without checking the definition (last time I
heard of
PODs was at least one year ago).
The second part (starting by BTW) was written [..]
So, maybe, even not reading the whole message, but at least the
beginning before the
end, would help you to understand the true message I posted.
No, sorry. It would not. Pure noise. Total waste of time.
POD = Plain Old Data i.e. a struct or class with no special behavior in
the case.
Only you know what your app needs to do. I am just exploring
possibilities that you can either use or reject as suits your needs.
joe
Le 16/08/2011 15:04, Victor Bazarov a écrit :
Maybe reading the end of the sentence before answering, it would help you
not to write nonsense. Why don't you just read the end of the parenthesis ?
"delete ptr_ in the destructor". And you couldn't say that a class having
"delete ptr_" in the destructor isn't POD, as I state in my message, due to
sections 9.10 and 9.6, stating that a POD is a trivial class, that a trivial
class is trivially copyable, and that a trivially copyable class need a
trivial destructor, which is not the case of a class containing "delete
ptr_" in its destructor.
I already answered, but it looks like there had been a misunderstanding, so,
in order to be nice, I will re-post with removing the useless parts.
AFAIK a POD may have special behavior.
I just checked the latest free paper about C++0x, and I saw this.
On 08/17/11 10:11 AM, Leo Equinox Gaspard wrote: [...]
A class isn't a POD if it has a destructor, trivial or not (9 pp4).
Check 9 pp4 in the 2003 standard and the third example in 9 pp10 in the
new one.
Le 17/08/2011 00:29, Ian Collins a écrit :
Oh, I answered your first message without understanding that you were
speaking of the 2003 standard.
However, I think third example of 9pp10 implies the destructor's body,
not shown here, is doing something.
And I apologize for my message saying 9.6 in place of 9pp6.
The standard's text is never mentioning the absence of destructors, but
only the triviality of destructors.
--ITYM "wrong estimate"
There is no "right" estimate,
a quadcore cpu with precaching and all the
fancy tech they have nowadays will probably do it alot faster than an
ancient AMD cpu.
So you are "wrong" to say my estimate was "wrong".
--the number taken is independent of the number of entries in the table
-- goto table;
--we're talking half a dozen instructions and a couple of memory
--accesses
Start Process:
Load reg1 with comparee (Only done once at start)
Load reg2 with case option
Load reg3 with jump address
Jump if reg1and reg2 are equal .
repeat above until the condition is met.
Why do you need to repeat 6 instructions ?
And what are you talking about memeory access? L1 cache? or pipeline cache
or prefetched queues?
Modern CPUs have everything all prefetched into caches and its a bit more
complicated than you seem to understand.
You can try to pretend you know more than me about it and I don't really
care if you do or don't but when you challenge something I said as wrong and
present "your opinion" as right, I'd suggest you get your facts right first
and provide some kind of evidence which supports your "claim".
Even if your opinion that it was 6x525 clock cycles ,
for any given CPU, was
100% exact then that would make my estimate close enough to be accurate,
no
because we are talking about cpu speeds in gigahertz now.
Paul said:I said "even is the last condition is the only one that is true".
No you are twisting the context from that of an unordered switch case, to
what you incorrectly assumed to be that of an ordered switch case that was
implemented as a jump table.
Leigh Johnston said:Epic fail yet again. Get a clue.[...]
Yes epic fail on your behalf.
How many times in the past have you been proven inferior?
No need to reply I think we all know the correct answer to that question.
Hi Paul,--hence my "estimate" is in clock cycles (instructions actually)
If you think you are so smart lets see the C++ and the assembly and tell
me which compiler produced it.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.