It appears I stand corrected. It also occurred to me that even if it were a problem, the operator used to dereference a pointer could be changed, and the issue would disappear.
Posts made by Heron
-
RE: C++0x
-
RE: Mashup Challenge $100,000 prize - WTF if Spectate Swamp wins?
@MasterPlanSoftware said:
@Heron said:
The neighbor I mooch internet access off of is the guy who runs ActiveTrails :)
That is going to get awkward then, since I just emailed them about how ridiculous this thread is....
Goodbye free internet tubez!
I fail to see how an e-mail to ActiveTrails regarding the idiocy of this thread would result in the end of my free internet access.
Besides which, he's using my WRT54G.
-
RE: Mashup Challenge $100,000 prize - WTF if Spectate Swamp wins?
For a better sense of what we mean, let's take a look at a few of our favorite Mashups.
Go ahead, click on the examples below. Read the "about" pages to get a better sense of the project’s goal/mission, and how the site works. (Yes, this is kind of technical, but we’re going to help make sense of that. Enjoy!)
- Maplight.org, a winning NetSquared project from last year, displays the link between money and politics by bringing together information about campaign contributions and legislative votes.
- ChicagoCrimes.org is a browsable database of crimes in Chicago that lets users see information displayed on a map.
- ActiveTrails shows visitors a list of active hiking and biking trails across the United States. Users play a big role in supplying information.
- Tunisian Prison Map pulls from a variety of sources to locate the prisons on a map and links to videos and other information relating to the prisons.
The neighbor I mooch internet access off of is the guy who runs ActiveTrails :)
-
RE: The Slow Math
It's not that the function doesn't do what it's supposed to, it's just that it does so stupidly. I'd bet that this:
Int16 Sign(Double value)
{
if (value > 0)return 1;
else if (value < 0)
return -1;
else
return 0;
}Would be faster, because it doesn't require a divide or a function call, it just requires examining a sign bit.
-
RE: It Support from hell.
The Real WTF(tm) is that rasjani keeps spelling "roughly" incorrectly. And that a supposed IT worker fails to capitalize IT every single time making it hard to tell whether he's saying "it" or "IT" (since "it" is, of course, an actual word). I think my brain FARTed a few times reading that.
-
RE: Best f**king censorship ever
So if I were having a conversation with a friend about the aliens in Ender's Game (referred to as "buggers" iirc) then this filter would block it. That's nice of them.
-
RE: C++0x
@bstorer said:
Have you ever given any thought to why the language requires semicolons, when the compiler can figure out when one is missing?
There are times where the compiler cannot figure out what to do. Consider the following:
[code]int* q = new int; int x = 5; *q = 7;[/code]
What would happen if the semicolon were missing?
[code]x = 5*q = 7[/code]
The compiler would assign 7 to the pointer q (not the memory pointed at by q), then multiply 5 by q, and assign that to x. That is certainly not the same.
Yes, the compiler might be able to see that q is a pointer and therefore the * is dereferencing it, but multiplying by an int* is still technically possible, and maybe that's what the programmer intended for some reason. I realize that few, if any, programmers would write something like the second statement on purpose, but they would certainly write things like the first snippet, and without semicolons the statement changes meaning.
So you see, semicolons do serve a useful purpose.
-
RE: The new memcpy!
@MasterPlanSoftware said:
Alright, I am curious now. Just how much profiling CAN you shake a stick at?
About the same amount as how much wood a woodchuck would chuck if it could chuck wood.
-
RE: C++0x
I'm interested to know whether the arbitrary limit the compiler puts on template recursion is higher than the arbitrary limit on functional recursion imposed by the limited availability of stack space. I'm pretty sure that all template recursion could be accomplished some other way (using functional recursion), so if the compiler's limit on template recursion is higher than the limit imposed by stack space, then we're getting more computational power from the compiler than we could from a regular recursive function. (If that makes sense.)
bstorer, I'll concede the "undecidable" point to you - with the caveat that I don't necessarily think that the mere possibility of writing an infinitely recursive template means there's some huge design flaw in C++, any more than the mere possibility of writing an infinitely recursive function means there's a huge design flaw.
Just because they let you do it doesn't mean it's badly designed.
I don't know if you're religious, but if you are, perhaps an analogy will illustrate what I mean (and if you aren't, the analogy should still hold): God lets us choose what we want to do, whether or not those choices are good, whether or not they result in salvation or condemnation. That doesn't mean that God's decision to allow us the freedom to choose was a bad design decision, it simply means that the advantage gained through allowing the freedom is greater than the risks involved. I think the same is true regarding templates - they can be abused, and they can make compilers barf all over themselves, but they provide distinct advantages that, in my opinion, far outweigh the "risks" involved.
Someone said something along the lines of "in general, you can't know ahead of time whether or not a C++ program will compile". That's a very poor generalization; in fact I would say that in general, you almost always know whether it will compile, assuming you're the one writing the program and you're a competent programmer. Granted, it may be difficult if you're messing around with recursive templates, but most C++ programs don't use recursive templates (I have never written one non-academically, myself), and even then it's really no harder than messing around with recursive functions. The skill required to determine visually whether a given recursive template will compile is no more than the skill required to visually determine whether a given recursive function will terminate (visually meaning "by a human"). Most programmers I'm acquainted with are capable of that, but I'm aware that there are some less-capable programmers out there (this is, after all, a site of WTFs).
-
RE: C++0x
If you'll notice, bstorer, I specifically said that in practice it's never a problem. I doubt any of us have seen code like this outside of an academic setting (like this one).
-
RE: C++0x
@mfah said:
Hold on - it's a long time since I was in college, but printf is still the first thing you learn after "main", isn't it?
I learned C++ on my own. The programming class I took in high school taught C++ (nothing I didn't know already). When I got to college the entry-level classes used Java. The first time I used C was in an electrical engineering class, and all I did was look up two or three printf flags. My current job is a C++ application that came from old C code, so it has calls to printf scattered around on occasion, but I just look up the flags when I need them... printf isn't as universal as it once was ;)
-
RE: C++0x
@CDarklock said:
@tray said:
Ok, but how do you pronounce "C++0x" ?
You have to use gutturals. It goes CHHHHHHHAWKKKKHHHH, and then you spit.
I have to say.... that made my night :)
And to bstorer, you make several good points... But it's more of a theoretical problem than a practical problem, and it's just as much of a problem in C as it is in C++. In practice, though, the compiler knows whether a given symbol is defined until "now" when it comes to a line of code (it keeps a lookup table), and it knows whether it's a typename or a variable. So while technically it is true that you could create an example where a line of code would be undecidable (i.e. using a template metaprogram), using a typename in a parameter list isn't one of those cases in practice.
-
RE: C++0x
@Nandurius said:
One interesting fact about the grammar is that it can't be easily defined. It's no wonder everybody has problems remembering every case.
So C++ is unpopular? Gee, we should go tell all those game studios who sell millions of copies that if they used Java they could sell millions more! Don't tell me that quote doesn't say C++ is unpopular, because it does: All X are like this, but Y is not like this (implication being that Y is not among X).@C++ FQA said:
Outstandingly complicated grammar
"Outstandingly" should be interpreted literally, because all popular languages have context-free (or "nearly" context-free) grammars, while C++ has undecidable grammar. If you like compilers and parsers, you probably know what this means. If you're not into this kind of thing, there's a simple example showing the problem with parsing C++: is AA BB(CC); an object definition or a function declaration? It turns out that the answer depends heavily on the code before the statement - the "context". This shows (on an intuitive level) that the C++ grammar is quite context-sensitive.
Yes, some of C++ is context-sensitive, but that's a consequence of allowing user-defined objects, not a consequence of complexity. I don't know of a completely context-free language. C++'s grammar is not undecidable - the example of AA BB(CC) is misleading, since the two cases are quite simple:
1) If CC is a list of variable declarations (e.g., "int x, int y, int z") then it must be a function declaration.
2) If CC is a list of values (e.g., "5, s, t()" where s is a preexisting int and t is a function returning an int) then it must be a class object instantiation.
There is nothing "undecidable" about that. Saying it "depends heavily on the code before the statement" is outright false, since determining whether it's an instantiation or function declaration does not require knowledge about any other part of the code. (Yes, you need to know what a Foobar is to instantiate one, but you don't need to know that to determine wehther it's an instantiation or a function declaration.)
You cannot forward-declare a function by saying "int foo(3, x, y);" nor can you instantiate a class object with "Foobar foo(int x, int y, int z);". The second one would be interpreted as a function declaration where the function returns an object of type Foobar.
It would seem that whoever wrote that FQA is far from being an expert in language design as they seem to imply. Reading through a few of their examples, I find a striking simliarity with rants bashing various churches for no better reason than to bash; they word things their own way to make the object of their rant seem bad. (For example, they imply that C++ is unpopular even though that is clearly not the case.) Sure, C++ isn't perfect, but neither is C, nor Java, nor anything. It is not the right tool for every job, but there is no one tool that works for every job. The FQA authors clearly have a distaste for C++ and they did not take the time to understand C++ enough to be able to understand what they're writing about.
To make my point clear, I have just shown that determining whether a statement of the form AA BB(CC) is a function declaration or an object instantiation is a context-free process, therefore the author of that FQA question is either stupid, lying, or not trying to understand what he's ranting about. I have sent an e-mail to the FQA author correcting the quotation in question; if he ignores it we'll know for sure whether he cares about the truth or whether he simply wants to rant.
For what it's worth I don't consider C++ too complex; templates are not particularly difficult to understand (even template metaprogramming), the syntax is just as easy as C, and I personally find development time faster in C++ than Java (and C#, except for GUIs). These are my own opinions and should be treated as such - no one flame me with a "C++ DROOLS, JAVA RULES" or whatever.
And I had to laugh at this quote from the FQA:
And the best part is that C++ devotees dare to refer to the C features as evil, and frequently will actually resort to finger pointing and name calling when someone uses them in C++ code
because he does the exact same thing (that is, finger pointing and name calling).
-
RE: C++0x
@tray said:
Ok, but how do you pronounce "C++0x" ?
Assuming you're joking, I'm answering anyway:
"See Plus Plus Oh Eks "
-
RE: C++0x
@boh said:
Funny, I find
@Std C said:
printf("Literal %-5d: %6.2f\n", i, f(i));
much easier than
@C++ said:
std::cout << "Literal";
std::cout.width(5);
std::cout << std::left << i << std::right;
std::cout.precision(6);
std::cout.width(0);
std::cout << std::fixed << f(i) << std::endl;
In fact, the second example probably doesn't even do what I wanted - I don't like the stuff, and I don't use it. It's just too wordy, and you give up control over what gets printed (hidden states in the stream object). I'll use a good old FILE* and fread(buf, sizeof(int), BUFSIZE, f) any day. I'm not saying I want to use plain C - objects are good and useful - but many aspects of C++ are too clunky and wordy for me. Or maybe I just don't see the beauty of them, I don't know.
That's great and all, but if you're unfamiliar with printf's formatting syntax and you just do a quick glance at the code, you know exactly what the C++ snippet is doing, but you have to go look up what the printf statement does.
Honestly, in this case, I think people are more comfortable with what they learned first - I learned C++ first, so I'm more comfortable with iostream and friends, whereas people I know who learned C first are more comfortable with printf and friends. Neither is necessarily better than the other (though iostreams can be slower in some cases), they're just different ways of going about the same thing.
-
RE: C++0x
@JukeboxJim said:
I agree there's definitely a WTF in asking who would bother using template recursion when normal function recursion would be just fine but that's the programmer being a retard rather than the fault of C++. Template specialisation has a lot of legitimate uses, although I would agree that a Fibonacci sequence generator (etc.) probably isn't one of them.
It depends on where you want the calculation run -- with regular functions, it's a run-time, with template recursion it's a compile-time. One uses the programmer's time once (and gets reduced to a constant generally), the other uses the user's time every time it runs.
It's not a WTF at all unless you use it wrong. A Fibonacci number generator is useful in template-recursive form if you need to be able to change which number you're getting (at compile-time), and you don't want to calculate it yourself, but you don't want to waste the user's time.
Something tells me I didn't make much sense there but since my brain is exploding in frustration at my manager right now I'm not going to try to reword it. Read it as I meant it, not as I wrote it.
-
RE: Best of SharePoint 2007
@rexmorgan said:
- bool condition = true;
while(condition)
{
//snip
condition = false;
}
This type of thing is used fairly often when people need to do the equivalent of:
foo();
if(failed())
goto bar;
foo2();
bar:
cleanup();
but they've heard that goto is evil so they use a while loop and a break to "hide" the goto.
To be fair, most people would do:
do
{
} while(false);
if they wanted to do what I've described.
- bool condition = true;
-
Sourcesafe WTF
Yeah, TRWTF is that we're using Visual Sourcesafe and not CVS/SVN/whatever-your-favorite-is.
So I got to work this morning and decided to write the documentation related to the two dialogs I had coded up on Tuesday (I only work tuesday-thursday right now, silly school). I grab the latest source code from sourcesafe, compile, and lo and behold the dialogs I spent three hours on on Tuesday simply don't exist. That is to say, the button that brings them up was still there, but nothing happened when it was clicked.
I opened up the file containing that dialog code and it's completely gone... vanished. There is no evidence that the dialog code ever existed. Not willing to give up, I checked the revision history - and it didn't show a checkin on that file in the last several weeks. Two other guys apparently had the same issue yesterday.
The WTF is that Sourcesafe saved the changes I made to the resources file (the dialogs) but not the source code (the code behind the dialogs).
I must say that it integrates very well with VS2k5, but if there were a working CVS or SVN plugin for Visual Studio I'd try to get the company to switch...
-
RE: VS2005 / MFC WTF
@Jonathan Holland said:
Why are you still using MFC?
I count my blessings that we're using MFC and not that homegrown "cross-platform" UI crap that older versions of our commercial product used. When your program is over 2500 files and several million lines of code, you don't go changing UI infrastructures all willy-nilly. (I know, I know, ideally it shouldn't be that hard. But still.)
-
RE: Vim 7.1 WTF when trying to comment out an empty line.
anyone want to make bets on how soon someone will post the de-obfuscated screenshot?
-
RE: What are merge lanes for?
@SuperousOxide said:
And risk getting soup on your paper?
I'm in class right now, trying my hardest not to laugh :)
-
RE: Easily hacked...
@medialint said:
Yikes. 30? I happened to have a DB with about 20,000 records with e-mail handy and the @mycompany.com part is 15 including the @ and .com. About 25% of the e-mail addresses are longer than 30.
I worked at a data management company... We had to make our e-mail database fields length 100... length 50 would clobber around 30% of the addresses in our database. Some people's e-mail address is way too long.
-
RE: Ubuntu WTFs
@db2 said:
So I fired up the live CD a second time, and verified the network settings. Yup, it saw the network card, and was set for DHCP. But ifconfig shows the interface as up with no address. Hmm. I ran dhclient manually from the terminal, and lo and behold, I get a network address. This time, the installer ran perfectly.
You know, I tried to get 7.10 to install the other day, but the wireless wouldn't work. I bet I just needed to run the dhcp client manually to get it to work. Kinda stupid considering 6.10 works flawlessly on the same machine.
-
RE: Scientology BOGOF?
I think the CoS is a WTF as much as the next guy, but that picture is photoshopped. This isn't worth a Sidebar post.
-
RE: Yet another Vista WTF
@Jonathan Holland said:
On a side note, I can't remember a time I installed a OS that didn't recognize the NIC, but I digress.
My laptop is a Dell Inspiron 6400 purchased in March of last year. The particular hardware Dell chose to use for several of the laptop's components do not have drivers that ship with XP SP2, including the NIC and the wireless. (Makes it hard to download the drivers from Dell's website).
They also sent me the wrong driver CD. Twice. I made my own after that.
-
RE: Deleting the Alternate Control
@Otterdam said:
But there's no sense crying over every blank post
You just keep on trying till you run out of toast
and the tagging gets done and you try to poke fun
at the people who are still aliveThe
caketoast is a lie! -
RE: A Backup Story
@AbbydonKrafts said:
I've had that happen before (not the virus part, just re-install). But, having a spare connection is one of the benefits of having multiple computers. Also, burning off the installs of all major software downloads helps out tremendously on a re-install. My external drive has hundreds of installers for various utilities and other applications that I use, too. I can cart it around between computers. Right now I have it hooked up at work since I keep all of my ripped MP3s on it.
I do more or less the same thing. Whenever I want to do a clean install, I make a list (on paper) of all the programs I have currently installed that I wish to keep. Then I check off the ones I already have install CDs for - Visual Studio, Office, etc. Then I download new installers for the rest (avast antivirus, OpenOffice, mIRC, FileZilla, etc), burn them all to a CD, and throw out my old "installers" CD. This way I always have a relatively recent "installers" CD in case something scary happens and I have to do an emergency clean install. I keep my e-mails on an IMAP server somewhere out there in the ether, so I just have to backup my savegames, ripped mp3s, and documents...
Used to be that all of my music and documents and stuff fit on one CD. The last iteration used two full DVDs (not including the installers CD).
-
RE: Nietzsche Interviews... WTF?
@cconroy said:
Also, WTF is a philosophy student doing applying for a programming job?
I know a lot of people who have programming jobs but are not CS students - for example, the company I work for writes water modeling software for civil engineers, and all but two employees are civil engineers. The other two (which include myself) are CS majors. The civil engineers are good programmers.... most of them, anyway.
My point is, it is not necessary to major in CS to be a programmer. Maybe the guy studying philosophy has been programming as a hobby for years, enough so to be a competent programmer (but still a jerk).
-
RE: Is it plugged in?
How do you debug the BIOS logic if the motherboard has no power with which to run the BIOS?
-
RE: Credit card WTF
Well even though they said they fixed it once and for all, they didn't. I'm getting pissed.
-
RE: Iterator<vector>
I count ten(ish) WTFs in that code... geez. That's almost two WTFs per line.
-
RE: Credit card WTF
@MasterPlanSoftware said:
If this sounds like too much trouble, then you think just like me. So instead, I keep enough in my checking account to cover at least 2 month's worth of bills. Would have to be a pretty big WTF to overdraft this way.
I was told today that I was misinformed about the exact effects of my checking account overdrawing from my credit card. That type of transaction isn't a purchase, so interest accrues immediately :( They told me, when I set up the account to do that, that there were no fees for it. I guess in their book interest doesn't count as a fee. In any case, in an effort to avoid paying interest like that again, I'm planning on doing what you suggest here - put several months' worth of bills in my checking, and keep it at that level.
Now, to earn several months' worth of bills..
-
RE: Credit card WTF
@snoofle said:
Sure fire solution. The bank is most likely a publicly held corporation. Get the main number of the corporate offices (not the number on the back of your debit card). Call it and politely ask for the office of the president. When they inquire, <i>politely</i> tell them that you've gotten the royal run around while trying to resolve an issue, and are really mad, and don't want to take it out on <whomever answers the phone>, and could they please direct you to someone who can help. Invariably, you will be directed to someone who shields the brass from folks like you, BUT they will have the brains and the authority to actually fix your problem. KEY: be polite as they don't have to help, but will gladly do so if you ask nicely!
That's essentially what I intended to do (but in person). I got my friend to drive me to the bank (my wife has the car for her ~1 hour each way commute), then I went up to the teller and told her what the problem was (all of the loan officers were out to lunch, at 3:30pm... WTF#1). She called someone who put her on hold while they called someone else... turns out, whatever idiot set up the card set it up as a car loan (WTF #2) with the wrong type of interest (WTF #3), so not only has the loan been screwed up since last september, but they've been charging me way too much interest (as in, I haven't been getting the standard 1 month interest-free grace period, and my tuition for this semester was on there...). So she said accounting was on it, they're going to fix the account type and the interest as well as refund the amount of extra interest I paid. Hopefully they'll actually fix it this time instead of just telling me they fixed it...
-
Credit card WTF
So I have a credit card through my bank, and it has generally been a very convenient addition to my account - checking overdraws come from my credit card, so no need to worry about checks bouncing. However, every time I pay off the balance on my credit card, the following business day I find that the bank has reset my due date to Oct 31, 2007, which of course is in the past. The first charge after this happens succeeds, but all following charges are declined because they think my account is delinquent... Oddly, charges to my debit card (which overdraws from my credit account, remember) work fine, whether or not there is any money in my checking account (I don't keep money there anyway).
Even more of a WTF, this has happened three times now; the first two times I was assured that it would never happen again. The second time I even went in to a loan officer in person (instead of their call center) to make sure, and she assured me it had all been fixed.
My cell phone autopay was cancelled at some point because of this, and if it keeps up I bet it's going to mess up my credit rating. I'm starting to get angry about it...
-
RE: Siemens T-OUCH
@Lingerance said:
@random_viewer said:
I would guess that 109 correlates to a record in a master password book. probably not the actual password.
You must be new here.Well that [i]was[/i] his first post.
-
RE: Room Heating
I worked at a place where the building's heating and a/c was divided in two, by hallway. One hallway (the main one) had the "server room" (conference room minus furniture) off of it and so the boss kept the a/c on permanently in the summer and the heat down around 60 in winter. My office fortunately was off the other hallway where we could set the thermostat to a more reasonable temperature, but the boss' wasn't - so he wore sweaters constantly. I didn't, of course, but that meant that I would go into his office in my short-sleeve shirt and shiver while I looked over his shoulder as he would describe in lengthy detail how he wanted me to clean up the next customer's data. The corner office at the intersection of the hallway was an odd temperature... but then, there was a desktop-turned-server in there, too.
Yeah, The Real WTF(tm) was that boss.
Less of a WTF, but still odd, is the furnace in my apartment, which is always blowing air, whether or not it's heating. It heats correctly to the temperature I set, but once it gets to that temperature it simply turns off the heating element but not the fan. It makes the bedroom cold :(
On topic, I'm told that the thermostats in the teacher's offices in the Electrical Engineering building on campus are set to specific temperatures by whoever maintains the air system - and the teachers literally get irate calls if they change their thermostat by even one degree. But at least the thermostats work as expected. I guess the per-room thermostat would be if they were only interested in a max and min temperature? Maybe they were just lazy and only one thermostat is actually hooked up to anything ;)
-
RE: 20/80 hindsight....
@NerfTW said:
If you mean that the low temperature is higher than the current, that's because the "hi/lo" statistics are just that, the highest and lowest temperatures recorded under those conditions in the past. The current teperature won't be factored in until they add that day's high and low to the system, the next day. This would therefore be a new low temperature.
I think the real WTF is that you don't understand weather statistics.
I was under the impression that the "low" temperature was the projected low temperature for the day, something that is definitely not based exclusively on historical data. I Am Not A Meteorologist, however.
-
RE: Functions Considered Harmful
@SpectateSwamp said:
http://www.telusplanet.net/public/stonedan/source.txt
This code works really well. How would you improve on it?
SpectateSwamp, I'm going to tell you something because I think you could use the help. I'm not trying to be mean, so please read what I'm going to say.
Here is what I'd do to improve your program if I were in your place right now:
1) Evaluate whether your intended software product is actually needed and whether it would be useful on the market. If not, abandon the entire idea.
2) Learn to write programs without using goto. NEVER EVER USE GOTO EVER AGAIN. See http://xkcd.com/292/ for reference. It's a comic, but its point is quite true. You might be better off switching to C# just to force yourself to learn something new. Functions and objects are your friends, learn to use them. As a side note, line numbers make very poor labels - line numbers change all the time.
3) Learn to name variables with descriptive names. Comments should describe *why*, not *what*. Using functions will help greatly with this - using local variables in functions will make it much easier to give them unique names in their scope.
4) Start over - delete your current code, and create a new project. If you're using C#, go download Visual C# Express from Microsoft's site (but beware, the license for the Express editions explicitly prohibit using them for commercial purposes, so if you plan to try and sell your product you'll need to purchase Visual Studio. If it's open source or just plain free, Express will work fine). Seriously, start over. If it takes you three days to write a flowchart, your program is too complex.
5) Plan the entire program out before you write a single line of code for it - know exactly what you're heading for. If you're not sure exactly what functionality it will need, plan how you will provide an easy way to expand your program's functionality later, whether that's through plugins or something similar.
6) Now you can start writing some code. Don't get ahead of yourself. Test your code constantly. Get other people to look at it and see if they can point out flaws you can improve on. Learn to take constructive criticism - if someone tells you "this is something you should avoid at all costs" or "this code is horrible", ask how you can improve on it and then do it. Asking is only half the task - you actually need to implement the fix they suggest to you.
I'm really not trying to be mean, and I hope you actually take this to heart. Stop trying to tell people "it's good code because it works". Not all working code is good code. You need to help yourself by learning a new way to program.
Hope this helps.- Heron
-
RE: For your amusement, brought to you by std::vector
I think that's the solution they settled on. Below that class declaration was a small function that took a reference to a std::vector and did what you are describing. They just never took their derived class out because it was used all over the place.
As a side note, I spoke with the guy in charge of that code and he agreed to remove it from the code entirely.
-
RE: For your amusement, brought to you by std::vector
Both of you are correct; shadowman's delete causes issues at runtime, and JamesKilton's allocation fails at compile-time.
They did this originally because they wanted to add in a function that would let them shrink the capacity to the size.
With std::vector, if you have std::vector<int> myvec, myvec.size() <= myvec.capacity(), but myvec.capacity() can be (theoretically) arbitrarily large. They wanted to provide a way to make the vector reduce the amount of memory used by the vector. I'm not sure offhand if there is already an easy way to do this or not. In any case, they made this placeholder class to use instead of std::vector until they could figure out how to make it work... they never did.
-
RE: For your amusement, brought to you by std::vector
Hmm, it didn't want to keep my brackets. Oh well.
-
For your amusement, brought to you by std::vector
This gem has been in our code unchanged for quite some time (several years):
[code]
template <typename T>
class VEC : public std::vector<typename T> {
public:
// VEC class does not always work the same as std::vector.
};
[/code]
There is historical reason behind this, but even the historical reasons are WTFs, and the code itself has many layers. A cookie and three points go to any who can list them all.
-
RE: I forgot that too.
@PhillS said:
Send them a letter back saying, "No thanks, we already have a penguin".
I'm sitting here in my history class biting my tongue to keep from laughing. Thanks :)
-
RE: Why use Sql When you can do it by hand?
of course, by "behind my back" i meant "behind my boss' back".
-
RE: I officially work with dilbert
DaveK... it says "get up and go *contact* the Helpdesk". You lose.
-
RE: Why use Sql When you can do it by hand?
nsimeonov... that's just sad. Popularity could help you *keep* your job if there are problems. It could get you raises... if you're popular with your boss(es), which you likely will be if you're increasing efficiency everywhere.
I had a job at a database company (managed other companies' databases) where I spent my last month going behind my back and making my friend's job easier because me leaving was going to force him to take on my workload (which at the time wasn't much... I *wasn't* popular with that boss). I took a six hour, fifty-step process and made it a twenty minute, three-step process. Go go gadget Automation! For the record, I quit, I wasn't fired.
My point is, it never hurts to be popular. Everyone at that job liked me *except* the boss, and noone liked the boss, and the boss had other problems. And even though the boss didn't like me, I was able to use the list of things I had automated to ask for (and get) a raise.
-
RE: Typo in EVE Online patch results in Windows installation corruption
Something tells me they didn't test this patch very well.
-
RE: VLC Pizza
@m0ffx said:
Yet KDE has the option for the MacOS menu bar placement (at the top of the screen).
I hope you don't mean to imply that you think GNOME doesn't... mine's there right now ;)