You've got it backwards... DirectX doesn't support cars, cards support DirectX (hereafter, "DX"). When we say, "The Radeon 9700 is a DX9 card," what we mean is that the Radeon 9700 can support all of the DX9 features *in hardware* (in the DX HAL ("hardware abstraction layer"). The GeForce4 is a DX8.1 card, meaning that it can support all of the DX8.1 features *in hardware*, but if you install DX9 on your system nothing horrendous will happen. All that will happen is that when a program tries to use DX freatures that your card doesn't support, DX will simply implement those features in software (on the HEL ("hardware emulation layer")), which is slower. But when a game just uses DX8.1 features, it'll still run on the HAL.
So, assuming that there aren't any bugs in the new version of DX, upgrading isn't harmful. And no, the Voodoo 3, 4, and 5 aren't going to support many of the new features in hardware. But that doesn't mean you can't install and play DX9 games -- it just means they'd run like ass.
A few points. First, there is a better way to do this, but yours isn't it. Second, just because the compiler gives a warning doesn't mean it's wrong (or that it should be fixed). What it means is that you better know damned well *why* the compiler gave a warning and why it doesn't matter, and you should probably have a comment indicating why you're smarter than the compiler. Third, it's not worth thinking about trivially modifying this for concurrancy. If f_sortacross can be modified by another thread, each read must be locked by a mutex, greatly slowing things down inside the loop. Anyway, here's the corrected, warning-free code. It's almost funny how trivial the fix is.
base = 0; for (row=0; row<numrows; ++row)
endcol = colwidth;
if (!f_sortacross)
base = row;
Yeah, that's all well and good when you're writing managed code. Data structures in managed code have all sorts of nifty bits of meta-information floating about.
Now back to my point that serializing C structs is non-trivial.
Umm... yeah. Can show me how serialize C structs in *any* portable data format easily? Serialization in C is non-trivial. Serialization in a portable format is *incredibly* non-trivial.
I have no idea what the origins of the legend are, I was refering to the etymology of the word. It very well may come from Persia, though. The Romans got the word "phoenix" from the Greek "phoinix", who could have easily heard about it from the Persians.
Re:Create() and exceptions
on
Qt vs MFC
·
· Score: 2
Sort of, but not quite. It's not a *design* change, it's an *implementation* change. Big difference. My only exception (polymorphic base class ctor throws) is the only situation where avoiding a throw in the ctor would actually require a design change.
I think we're pretty much in agreement, though. Don't know why anyone would go through all that trouble just to avoid a try block anyway.
Re:Create() and exceptions
on
Qt vs MFC
·
· Score: 2
Yes, that's the only way the object model can make sense *if you're containing actual objects*. You can easily get around that by changing the contained object(s) to a contained pointer to object. Same goes for private inheritance: change it to a contained pointer to object. If all your after is interface inheritance w/o polymorphism, just use a contained pointer plus forwarding functions. Like I said before, the only time you're *forced* to propogate exceptions from a ctor is when a polymorphic base class's ctor throws.
Re:Create() and exceptions
on
Qt vs MFC
·
· Score: 2
If::new fails then it will throw, sure. But the object is free to catch std::bad_alloc inside the ctor and transpose it onto some other error-reporting schema. Just because something *in* the ctor throws, doesn't mean that the ctor has to propogate the exception.
As far as ifstream is concerned, you can't tell *why* the file couldn't be opened because ifstream is abstracted that way. You could easily have some sort of "error state" (similar to badbit, eofbit, and failbit) which can be reported to the client only when the client asks for it. Simplest way I can think of to do that is with a get_last_error() member function that simply returns the error code of the last operation the object performed.
Sure, exceptions can be helpful in RAII, but they are by no means required by it. To assume so is not only incorrect, it diminishes C++'s lack of paradigm bias.
The only time I can think of when you're *forced* to propogate exceptions is when you have a polymorphic class whose base class's ctor throws. But then, you made a design decision to inherit from a class that throws.
Oreos or chocolate chip?
on
Qt vs MFC
·
· Score: 2
Beaten... why? I think it's fun:-}
You're right on both counts. See this Usenet post for a little more detail.
Re:Advocacy, we never knew thee.
on
Qt vs MFC
·
· Score: 1
Nope, that's *not* the correct way to code that, even in a high-performance section of code. The correct way is:
using std::swap;
swap(a, b);
If you want to have a nifty hack, then provide a specialization for swap. And don't bother complaining about function-call overhead. If it's really a one-line hack like above, any half-decent compiler will optimize the call away. And if the compiler doesn't, then there's no point in using it to write optimized code in the first place.
Anyone who can figure out why I used a using-declaration instead of explicitly specifying the namespace (ie: "std::swap(a, b);") gets a cookie.
Re:Create() and exceptions
on
Qt vs MFC
·
· Score: 2
Ummm... no. Qt may or may not report errors via C++'s exception mechanism, I don't know. But insinuating that exceptions are the *only* way to report errors encountered during a ctor is patently false. For a counter-example, one need look no further than the standard IOStream library:
int main() {
std::ifstream file("file.txt");
if(!file) {// look ma, no try block!
std::cerr << "file.txt could not be opened for reading.\n";
return EXIT_FAILURE;
}
return 0;
}
If Encarta was $1000 (and you could argue the price should be that high), I'd simply copy it. That's REAL capitalism.
You have a gross misunderstanding of capitalism. In *real* capitalism, you would simply do without Encarta. Perhaps you would purchase a competing product that you found to have a more reasonable price, perhaps not. But *stealing* is certainly not a part of, nor is it justifiable by, capitalism.
... stealing involves tangible items....
You also have a gross misunderstanding of the English verb `steal'. Perhaps you are not a native Enlgish-speaker, in which case this is forgivable. I suggest you look the word up in any of the sundry dictionaries available on-line. In particular, if you choose to consult Webster, pay close attention to definition 1c.
I'd love a 22" apple cinema display, I just can't afford it. That doesn't give me the right to break into compUSA and take one.
If you break into compUSA and carry something away, then they wouldn't have it anymore. If I copy your software, you will still have as much software as you had before. This is not just wordplay, it's a very real difference.
This whole "intellectual property" issue has been turned around and distorted by the software and entertainment industries.
You know, you're right. But the way I see it, you're not paying for property (intellectual or otherwise) when you buy software. You are paying for the *service* that the programmer provided. IMO, a much better term would be "intellectual service". When you look at it that way, the whole "but there's no loss of property" argument becomes moot. Would you not consider it stealing if someone agreed to pay you if you cleaned their house for a month, then after the month is up, refused to pay?
Well, I must admit, I voted for LotR as best book in more than a couple of polls over the years, but usually because the rest of the choices were utter nonsense. And it certainly ranks very close to the top in terms of books I've read (actually, I like Silmarillion more).
I must staunchly disagree with you concerning the most enjoyable parts of LotR, though. The second volume is by far my favorite, followed by the third volume. I enjoyed the first volume the least. Also, the "non-Frodo books" are the more enjoyable parts, IMO. Tolkien himself noted that it seemed that everyone had a different favorite and least favorite portion of the book... and that no two people could agree on which is which.
Finally, I note one of your points:
"I find it hard to admire a book that propagates values that I cannot respect."
Hello, what??!! So, just because you disagree with an author's values, you cannot respect the literary value of the work? What kind of crack have you been smoking?
No, he's saying that if you were so unsatisfied with Windows 3.1 and Windows 95 that you have *never* used or purchased another Microsoft operation system, then you are not qualified to critisize Windows 2000. And I tend to agree with him.
Also, you do not have to purchase a product in order to be familiar with it. I use Windows 2000 at work every day. I have become very familiar with it on both the client and server end, and I have certainly not purchased it.
I don't always see the Open With option. But even when it works, it lists *all* applications, not just those relavant to the file extension or type.
A better solution would be to associate *multiple* applications to a given extension, and then have it list that set upon Open With (with the option of adding to the set from the entire pool of applications.)
I don't know about WinME (but I assume it's true there as well), this is a feature of Win2K. First, there's an "Open With" option on the context menu *without having to click shift*. Second, the option is actually a secondary menu that lists *all* of the programs that were *ever* used to open files of that type with the "Open With" option.
I use this feature frequently. I have my MP3 playlist loaded in Winamp, and if I want to check out a song I just downloaded, I right click->Open With->Media Player, so my playlist remains intact. Or I can choose whether I want to open JPEGs in PaintShop, ACDSee, IE, or whatever.
This takes exactly the same number of mouse clicks and marginally more time than double-clicking.
We wear baseball caps in the US Air Force. Usually, each squadron (sometimes group or directorate, if the Sqd is small) has their own cap, with their patch on it. I would suppose that Starfleet would be a derivative of the USAF, so it does make sense.
Then you find out that all trailing f's are pronounced as v's (so Gandalf is actually pronouced Gandolv) and all C's are hard - as in they sound like K.
Actually, that appendix applies *only* to the Elven words. Tolkien very specifically states that the (human) languages of the north of Middle-earth(from which the Rohirrim, the men of Bree, the Beorningas, and the Hobbits all came) were meant to be more Old English.
So Gandalf is pronounced correctly by Frodo in the trailer ("Do they... do they Gandalf").
And not all 'C's are hard. Scatha the Worm is pronounced "Shatha". But Celeborn is certainly pronounced "Keleborn" and Celebrian is pronounced "Kelebrian".
And to whomever said that Gandolf was British? No, he was Istari. The person was refering to the *actor* who plays Gandalf as being British... not Gandalf himself.
Actually, they will be increasing Arwen's role in the movies. She will replace Glorfindel at the Fords of Bruinen, and I wouldn't be surprised if she joins Aragorn just before the Paths of the Dead (along with Elladan, Elrohir, Halbarad, et al). And, of course, putting the two of them together during the War of the Ring would require expanding the love story a bit. All the events in the appendix you mentioned occur *prior to* the War.
Hehe... you can keep your Morpheus and Kazaa with your 140K/sec downloads. I'll take my web downloads at 2.13 MB/s (yes, that's a capital 'B' -- as in "bytes"):-}
Do your drivers support DX9?
Also, the demos could simply refuse to run on the HEL. Dunno... haven't checked.
You've got it backwards... DirectX doesn't support cars, cards support DirectX (hereafter, "DX"). When we say, "The Radeon 9700 is a DX9 card," what we mean is that the Radeon 9700 can support all of the DX9 features *in hardware* (in the DX HAL ("hardware abstraction layer"). The GeForce4 is a DX8.1 card, meaning that it can support all of the DX8.1 features *in hardware*, but if you install DX9 on your system nothing horrendous will happen. All that will happen is that when a program tries to use DX freatures that your card doesn't support, DX will simply implement those features in software (on the HEL ("hardware emulation layer")), which is slower. But when a game just uses DX8.1 features, it'll still run on the HAL.
So, assuming that there aren't any bugs in the new version of DX, upgrading isn't harmful. And no, the Voodoo 3, 4, and 5 aren't going to support many of the new features in hardware. But that doesn't mean you can't install and play DX9 games -- it just means they'd run like ass.
IN SOVIET RUSSIA tongue's got your cat!
Yeah, that's all well and good when you're writing managed code. Data structures in managed code have all sorts of nifty bits of meta-information floating about.
Now back to my point that serializing C structs is non-trivial.
Umm... yeah. Can show me how serialize C structs in *any* portable data format easily? Serialization in C is non-trivial. Serialization in a portable format is *incredibly* non-trivial.
I have no idea what the origins of the legend are, I was refering to the etymology of the word. It very well may come from Persia, though. The Romans got the word "phoenix" from the Greek "phoinix", who could have easily heard about it from the Persians.
Wow... maybe because *it's not English*!
It's Latin.
Sort of, but not quite. It's not a *design* change, it's an *implementation* change. Big difference. My only exception (polymorphic base class ctor throws) is the only situation where avoiding a throw in the ctor would actually require a design change.
I think we're pretty much in agreement, though. Don't know why anyone would go through all that trouble just to avoid a try block anyway.
Yes, that's the only way the object model can make sense *if you're containing actual objects*. You can easily get around that by changing the contained object(s) to a contained pointer to object. Same goes for private inheritance: change it to a contained pointer to object. If all your after is interface inheritance w/o polymorphism, just use a contained pointer plus forwarding functions. Like I said before, the only time you're *forced* to propogate exceptions from a ctor is when a polymorphic base class's ctor throws.
If ::new fails then it will throw, sure. But the object is free to catch std::bad_alloc inside the ctor and transpose it onto some other error-reporting schema. Just because something *in* the ctor throws, doesn't mean that the ctor has to propogate the exception.
As far as ifstream is concerned, you can't tell *why* the file couldn't be opened because ifstream is abstracted that way. You could easily have some sort of "error state" (similar to badbit, eofbit, and failbit) which can be reported to the client only when the client asks for it. Simplest way I can think of to do that is with a get_last_error() member function that simply returns the error code of the last operation the object performed.
Sure, exceptions can be helpful in RAII, but they are by no means required by it. To assume so is not only incorrect, it diminishes C++'s lack of paradigm bias.
The only time I can think of when you're *forced* to propogate exceptions is when you have a polymorphic class whose base class's ctor throws. But then, you made a design decision to inherit from a class that throws.
Beaten... why? I think it's fun :-}
You're right on both counts. See this Usenet post for a little more detail.
Nope, that's *not* the correct way to code that, even in a high-performance section of code. The correct way is:
using std::swap;
swap(a, b);
If you want to have a nifty hack, then provide a specialization for swap. And don't bother complaining about function-call overhead. If it's really a one-line hack like above, any half-decent compiler will optimize the call away. And if the compiler doesn't, then there's no point in using it to write optimized code in the first place.
Anyone who can figure out why I used a using-declaration instead of explicitly specifying the namespace (ie: "std::swap(a, b);") gets a cookie.
Ummm... no. Qt may or may not report errors via C++'s exception mechanism, I don't know. But insinuating that exceptions are the *only* way to report errors encountered during a ctor is patently false. For a counter-example, one need look no further than the standard IOStream library:
// look ma, no try block!
#include <iostream>
#include <fstream>
#include <cstdlib>
int main() {
std::ifstream file("file.txt");
if(!file) {
std::cerr << "file.txt could not be opened for reading.\n";
return EXIT_FAILURE;
}
return 0;
}
// fotr.c
#include "tt.h"
If Encarta was $1000 (and you could argue the price should be that high), I'd simply copy it. That's REAL capitalism.
... stealing involves tangible items....
You have a gross misunderstanding of capitalism. In *real* capitalism, you would simply do without Encarta. Perhaps you would purchase a competing product that you found to have a more reasonable price, perhaps not. But *stealing* is certainly not a part of, nor is it justifiable by, capitalism.
You also have a gross misunderstanding of the English verb `steal'. Perhaps you are not a native Enlgish-speaker, in which case this is forgivable. I suggest you look the word up in any of the sundry dictionaries available on-line. In particular, if you choose to consult Webster, pay close attention to definition 1c.
I'd love a 22" apple cinema display, I just can't afford it. That doesn't give me the right to break into compUSA and take one.
If you break into compUSA and carry something away, then they wouldn't have it anymore. If I copy your software, you will still have as much software as you had before. This is not just wordplay, it's a very real difference.
This whole "intellectual property" issue has been turned around and distorted by the software and entertainment industries.
You know, you're right. But the way I see it, you're not paying for property (intellectual or otherwise) when you buy software. You are paying for the *service* that the programmer provided. IMO, a much better term would be "intellectual service". When you look at it that way, the whole "but there's no loss of property" argument becomes moot. Would you not consider it stealing if someone agreed to pay you if you cleaned their house for a month, then after the month is up, refused to pay?
Well, I must admit, I voted for LotR as best book in more than a couple of polls over the years, but usually because the rest of the choices were utter nonsense. And it certainly ranks very close to the top in terms of books I've read (actually, I like Silmarillion more).
I must staunchly disagree with you concerning the most enjoyable parts of LotR, though. The second volume is by far my favorite, followed by the third volume. I enjoyed the first volume the least. Also, the "non-Frodo books" are the more enjoyable parts, IMO. Tolkien himself noted that it seemed that everyone had a different favorite and least favorite portion of the book... and that no two people could agree on which is which.
Finally, I note one of your points:
"I find it hard to admire a book that propagates values that I cannot respect."
Hello, what??!! So, just because you disagree with an author's values, you cannot respect the literary value of the work? What kind of crack have you been smoking?
No, he's saying that if you were so unsatisfied with Windows 3.1 and Windows 95 that you have *never* used or purchased another Microsoft operation system, then you are not qualified to critisize Windows 2000. And I tend to agree with him.
Also, you do not have to purchase a product in order to be familiar with it. I use Windows 2000 at work every day. I have become very familiar with it on both the client and server end, and I have certainly not purchased it.
I don't always see the Open With option. But even when it works, it lists *all* applications, not just those relavant to the file extension or type.
A better solution would be to associate *multiple* applications to a given extension, and then have it list that set upon Open With (with the option of adding to the set from the entire pool of applications.)
I don't know about WinME (but I assume it's true there as well), this is a feature of Win2K. First, there's an "Open With" option on the context menu *without having to click shift*. Second, the option is actually a secondary menu that lists *all* of the programs that were *ever* used to open files of that type with the "Open With" option.
I use this feature frequently. I have my MP3 playlist loaded in Winamp, and if I want to check out a song I just downloaded, I right click->Open With->Media Player, so my playlist remains intact. Or I can choose whether I want to open JPEGs in PaintShop, ACDSee, IE, or whatever.
This takes exactly the same number of mouse clicks and marginally more time than double-clicking.
We wear baseball caps in the US Air Force. Usually, each squadron (sometimes group or directorate, if the Sqd is small) has their own cap, with their patch on it. I would suppose that Starfleet would be a derivative of the USAF, so it does make sense.
We don't wear them indoors, though.
Then you find out that all trailing f's are pronounced as v's (so Gandalf is actually pronouced Gandolv) and all C's are hard - as in they sound like K.
Actually, that appendix applies *only* to the Elven words. Tolkien very specifically states that the (human) languages of the north of Middle-earth(from which the Rohirrim, the men of Bree, the Beorningas, and the Hobbits all came) were meant to be more Old English.
So Gandalf is pronounced correctly by Frodo in the trailer ("Do they... do they Gandalf").
And not all 'C's are hard. Scatha the Worm is pronounced "Shatha". But Celeborn is certainly pronounced "Keleborn" and Celebrian is pronounced "Kelebrian".
And to whomever said that Gandolf was British? No, he was Istari.
The person was refering to the *actor* who plays Gandalf as being British... not Gandalf himself.
Actually, they will be increasing Arwen's role in the movies. She will replace Glorfindel at the Fords of Bruinen, and I wouldn't be surprised if she joins Aragorn just before the Paths of the Dead (along with Elladan, Elrohir, Halbarad, et al). And, of course, putting the two of them together during the War of the Ring would require expanding the love story a bit. All the events in the appendix you mentioned occur *prior to* the War.
Hehe... you can keep your Morpheus and Kazaa with your 140K/sec downloads. I'll take my web downloads at 2.13 MB/s (yes, that's a capital 'B' -- as in "bytes") :-}
They're cutting all the events in the Old Forest. As far as I know, they're going to jump straight from Crickhollow to Bree.
I don't know if they'll even explain how Merry and Pippin get their Numenorean blades... but my guess is that they will be gifts from Elrond.