2,898 Posted Topics
Re: What you want is the size of an element of the array, which is not `sizeof(typeid(arr))`. You need to use `sizeof(arr[0])`. Don't worry about if `arr[0]` exists or not, because the `sizeof` operator does not actually evaluate the expression, only its type. Warning: The method that you are using, i.e., … | |
Re: Yeah, I've referred people to that article so many times. There are great points, and it gives a good dose of "realism". | |
Re: > I thought `* value` is the number the pointer `value` points to Yes, but in order for a pointer to point to something, you need to allocate some memory and set the pointer to point to that memory. Before you initialize a pointer, it just has some arbitrary value … | |
Re: > So any conclusion for this? Did you just say impossible? Nobody's talking about it being "impossible", everything is possible. What deceptikon said is that it currently does not work that way (not in C++, and not in any other language that I know of), and that making this work … | |
Re: Another hint that might help you is this. The first even number higher than `x` can be calculated as `2 * ((x + 2) / 2)` (and the parenthesis matter, because this relies on integer division). You can use Schol-R-LEA's loop to do the rest. | |
Re: Around the time I was born, my parents had a Rottweiler, but she died young due to cancer. Rottweilers are awesome dogs too, they are super smart, gentle, don't shed much (short hair), but they have lots of energy, so you have to be ready for that (i.e., it's not … | |
Re: There are two common options for the code generation. Most compilers have an "intermediate language" that is kind of like C but less human-readable (i.e., a basic procedural language, but more compact). Other compilers simply generate C code and then compile it (for example, the Comeau C++ compiler just generates … | |
Re: > anyone, this is from second year of IT, anyone passed that? Seriously? What did you do the first year? Make macaroni art? From the example: if (x == 0) then // O(1) simple variable access for i = 1 to n do // O(n) a[i] = i; // O(1) … | |
Re: Good to hear you started using LaTeX. Once you get used to it, you'll probably never go back to using MS Word / LibreOffice programs. And obviously, Tex/LaTeX is not a legacy language, even though it's quite old (1978). At least for most scientific publications, it's the *only* viable option. … | |
Re: Hi Frank, It's a bit funny that you resurrect your presence in forums by resurrecting a 6 year-old thread (which we usually frown upon). Anyways, welcome to Daniweb! I should bow my head to you as I started my programming life with your products. Back when Borland still carried time-unlimited … | |
Re: > where they have all this awesome software and I always wonder what it is. 3D animation / modeling is usually done with a professional suite of 3D animation software, and often in combination with in-house software / add-on scripts. The most popular software, from my limited and somewhat out-dated … | |
Re: > One learns to play a piano well only by years of practice -- same with progamming languages. Good analogy. I'd add to it: One doesn't learn to play a piano well by only playing the same tune over and over again. You have to find new challenges all the … | |
Re: The problem with using the maximum value of a double is that you will most certainly lose all meaningful value in your samples array. For example, if you do `samples[i] / std::numeric_limits<double>::max()`, then it won't really matter much what the value of `samples[i]` is, unless it is extremely close to … | |
Re: A heap corruption problem is almost always caused by calling `delete` on a pointer that does not point to memory that was allocated with `new`. And yes, the `strcpy` function does not allocate memory, it only copies data from one location to another, it is your job to allocate the … | |
Re: The post quality score is definitely the best indicator for how worthy and awesome a member is. Shamelessly coming from another 97% scorer ;) (I'm sure JorgeM agrees with me!) > ... says the person who has a 97% post quality score ;) ... says the person who has a … | |
Re: I don't know how to feel about this. On the one side, I'm happy that the companies speak plainly and honestly about the crimes of the US government, and refuse to be complicit with them. On the other hand, I would like to see them refuse to comply (and not … | |
Re: I've heard the phrase "with its new colors, Apple is redefining what an iPhone can be".... that smells of desparation and of extremely complacent "critics". I mean, Apple is, of course, legendary for over-hyping minor things as being revolutionary breakthroughs and paradigm shifts, but this takes it to a whole … | |
Re: You must be very tired indeed. ;) When you construct the *object* "w" of *class* `Something`, it will contain a `data` vector with a size of 100. When you construct a second *object* "f" of *class* `Parser`, it will contain a `data` vector with a size of 0, because that's … ![]() | |
Re: > Probably not the best implementation, but, hey! If anyone has any more, feel free to post :) Definitely not, especially considering that it has a blatant memory leak. Overall, I have a really hard time understanding what you actually want to accomplish. Even the title is confusing "CRTP without … | |
Re: You want to know the reasons behind currencies going up or down in general? To answer that, you have to understand what money is. Fiat currencies (which are most currencies today) are records of debts that the treasury (government or a major bank) has incurred with the central bank (the … | |
Re: The point about learning Java well before moving on to C++ is a fair point from the perspective that Java might be an easier language to learn the basics. But that's the important point "the basics". Java and C++ are very different, and Java is far more narrow in scope … | |
Re: Qt is definitely the best, IMHO. It is not true that you need another IDE for using Qt. But it is true that it is easier with certain IDEs that have a tighter integration with Qt. This will be true for any GUI library out there. As far as I … | |
Re: I have a bug to report. When I click on the "XX hours ago" to jump to the last post on a thread, it gets me there but the top of the last post comes flush with the top of the browser window, and then, the floating "<DANIWEB>" purple bar … | |
Re: Yeah, "read" is in the past tense. Stupid English language. I was also even more confused with the "read" and "me" put together, for obvious reasons. I agree that the new layout is a little bit cluttered. And as far as style harmony goes, it seems the main thing that … ![]() | |
Re: The point is that you could evaluate the operands in any order. Lets add some parentheses: ( ( ( cout ) << ( a++ ) ) << ( " " ) ) << ( ++a ); For any of the `<<` in the above expression, the stuff above it or … | |
Re: The paragraph is very poorly written. I understand what it is referring to, but the wording of the text is horrible and imprecise. What it is referring to is the fact that template instantiations have internal linkage. This is to guarantee link-time satisfaction of the ODR (One-Definition Rule). Normally, if … | |
Re: That's odd. I can explain the "posts voted down" section showing only 3 posts. This is because this section only shows the posts that are currently negative overall. This means that all those down-votes were counter-balanced by the up-votes on the same post. But the overnight down-votes is very weird. … | |
Re: People, this is a signature spam post, look at the OP's signature. | |
Re: Any standard permutation algorithm will do. You have seven slots to fill, and you can permute the elements just like you would permute the elements of any array. C++ has a [standard implementation](http://www.cplusplus.com/reference/algorithm/next_permutation/) for it. | |
Re: The survey is a bit weirdly formulated. The questions seem to refer to the "last sketch/diagram" that I made. That could happen to be anything from the most involved sketch that I ever drew to the most trivial doodle on a random piece of paper. I went by the assumption … | |
![]() | Re: I just installed it on my old laptop (which had Fedora 19 on it, which has sort of died due to bugs and other issues). I like it so far. That laptop is old (6 years) and I don't use it for any heavy work (I use it as kind … |
Re: There are a few common options (and it's best to stick to what is common, and thus, most likely familiar to users of the library). The first important question to ask is: are you targetting an ABI-stable platform? In other words, do you plan to support Windows, or only unix-like … | |
Re: That is an absolutely terrible example, it should never appear in a book, or at least, not one worth reading (unless it is presented as an example of what not to do). In any case, what this MACRO is trying to do is automatically generate a list of objects of … | |
Re: > oh i thought that the x-- was the bit processing speed but its the architecture i guess. thanks! These are names for the instruction set (also called the architecture), they are technically not supposed to be named after the 32 vs. 64 bit thing. I don't know what you … | |
Re: It sounds like some sort of phishing scam. When I google for those numbers, I get hits of all kinds, mostly saying that each of these numbers are tech-support numbers for microsoft / MSN / hotmail, facebook, norton, and just about any other prominent IT company. My guess is that … | |
Re: We don't have a forum section dedicated to matlab, but you can post under "Software Development" directly and be sure to add tags to your question, specifically "matlab". | |
Re: > then whats the difference between using namespace and #include? doesnt #include also tells c++ to go look in this header file for this function or statement... Not exactly. A `#include` line is very little more than a copy-paste instruction. It tells the compiler to look for the given file … | |
Re: > A programmer having 5+ years experience in C++ programming, in the system and also game department... more or less what will they make? Of course, this depends on many factors, with respect to your qualifications, position, and your company's size. Generally speaking, it's around the mid 5 digits (USD), … | |
Re: There are a number of bugs in your code. Much of which you could easily figure out by simply adding a print out in the midst of the encoding/decoding loops and examine what happens when you try it. First, at line 51, you have `input[count] == 'z';` where it should … | |
Re: First, let me introduce you to two extremely useful standard floating-point functions: [frexp](http://www.cplusplus.com/reference/cmath/frexp/) and [ldexp](http://www.cplusplus.com/reference/cmath/ldexp/). The first allows you to do a base-2 logarithm (integer result, rounded above). And the second allows you to multiply a floating-point number with 2 to some integer power (positive or negative), and it does … | |
Re: I encountered a nice programming example of Schrödinger's cat. If you have this code: int main() { int a, b, c; a = 1; b = 2; c = a + b; cout << "value of c is " << c << endl; }; Then, the compiler is allowed to … | |
Re: My thoughts are that this framework you are describing is probably not going to take you very far, you will quickly hit a wall (or a number of walls). For one, it is obviously much too simplistic, as a typical game engine / framework would contain quite a lot more … | |
Re: My signature-spam detectors are going off the charts here, or is it just me? Rahul and Izhar, you are walking a fine line. If you keep going, you might get infracted and banned, again. The rule states: **Keep It Spam-Free** **Do** ensure that all posts contain relevant content and substance … | |
Re: Windows 8 is full of security holes and backdoors, everyone knows that. Accessible to NSA and anyone else. What's the news here? | |
Re: TortoiseGit is nothing more than a GUI front-end to Git. I would not recommend that you rely on it for any advanced work, especially if you are having some trouble with your repo. You should use Git Bash, i.e., the command-line utility, because that will give you all the info … | |
Re: Maybe you should try the follow [the official instructions first](http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html). | |
Re: Just a thought. Wouldn't the time stamping have more to do with the server's time service, and not with any of Dani's code. Maybe the server had a glitch of some kind in its time service (a reset, or something). | |
Re: My politically correct answer: The best tool depends on the type of tasks and the requirements. Bla bla bla, the right programming language is the one best suited for the job at hand. Bla bla bla, mention a bunch of programming languages and their advantages to please each person's sensibilities. … |
The End.