2,898 Posted Topics

Member Avatar for MrEARTHSHAcKER

> void h(void i() throw(int)); That is the declaration of a function called `h` which has no return value and takes one parameter, called `i`, which is a function with no return value and no parameters and that can only throw an `int`. When it comes to functions, you can …

Member Avatar for mike_2000_17
0
145
Member Avatar for asif49

The best way to find out is to try them out. There are many non-trivial issues beyond what you can reasonably predict based on theories (time-complexity or whatever else). It also depends on the factors that rubberman mentioned. The fastest traversal is always going to be with compact and contiguous …

Member Avatar for mike_2000_17
0
172
Member Avatar for ZaaZ

You have an error with this line: relativeX = (relativeX*cos(angInRad)) - (relativeY*sin(angInRad)); relativeY = (relativeX*sin(angInRad)) + (relativeY*cos(angInRad)); because you set the `relativeX` value and then use it again in the next line. You need to preserve the original value of `relativeX` until you have computed `relativeY`. This is probably what …

Member Avatar for ZaaZ
0
597
Member Avatar for LateNightCoder

> I don't know what this means even after looking online, I'm going to guess the pointer isn't being deleted, so maybe somebody could help me. If a pointer wasn't deleted, the program would not crash, only leak memory (which the OS will reclaim anyways). I'm pretty sure that this …

Member Avatar for LateNightCoder
0
232
Member Avatar for bgx90

> is there any problem with initializing those pointers with the initialization list of the constructor? No. It's perfectly fine. But you need to know what to do with the pointers once your object contains them (is your object responsible for deleting it? (hint: it cannot).. can you guarantee that …

Member Avatar for bgx90
0
3K
Member Avatar for MrEARTHSHAcKER

If you compile with a very strictly standard compiler, then that line will indeed produce a compilation error. For instance, you can try it with the [online Comeau compiler](http://www.comeaucomputing.com/tryitout/) (pretty much the most standard-compliant compiler that exists). I'm not surprised that many compilers do not care about this exception-specification-related rule. …

Member Avatar for MrEARTHSHAcKER
0
197
Member Avatar for adeel381

Here is an example of a recursive function (the `print_countdown` function, ignore the rest), you can copy-paste it and try it out: #include <iostream> #include <iomanip> #ifdef WIN32 #include <windows.h> static std::size_t get_stack_size() { MEMORY_BASIC_INFORMATION mbi; VirtualQuery(&mbi, &mbi, sizeof(mbi)); VirtualQuery(mbi.AllocationBase, &mbi, sizeof(mbi)); VirtualQuery((char*)mbi.BaseAddress + mbi.RegionSize, &mbi, sizeof(mbi)); VirtualQuery((char*)mbi.BaseAddress + mbi.RegionSize, …

Member Avatar for TrustyTony
0
144
Member Avatar for bgx90

The `-o` is to specify the output of the compilation, so, when you right: $ g++ -o test.cpp RefEnv.cpp You are telling the compiler to compile RefEnv.cpp and produce an executable file called "test.cpp", and because RefEnv.cpp doesn't have the main function, you get the error that you get. So, …

Member Avatar for bgx90
0
3K
Member Avatar for Nathaniel10

>Below is the one example that I can half way understand well enough to even start asking questions about linked lists. If that is the best example code you could find on linked-lists, then you're either very unlucky in your research, or half-blind. This code is crap. >Why is "struct" …

Member Avatar for Nathaniel10
0
299
Member Avatar for abhimanipal

In the newest standard, this function should be found under the `#include <numeric>` header. Also, I'm pretty sure that GCC has had this function and header for a long time (they list it as part of their 1998/2003 standard library, although it shouldn't be, to be strict) so it should …

Member Avatar for mike_2000_17
0
2K
Member Avatar for SillyNoob

Calm down. There is always a good explanation for everything. Your problem is with the lines 41 and 42. You are returning a pointer to a local variable. That variable happens to be a pointer as well, but that doesn't change anything. Your function returns a pointer to a local …

Member Avatar for SillyNoob
0
93
Member Avatar for Dani

> Codemirror suppresses the browser's spellchecker highlighting Then, drop the codemirror, IMO.

Member Avatar for Airshow
3
278
Member Avatar for Ankit_Parmar

The code you posted is illegal, should not compile (if it does, go complain to your compiler-vendor). When you declare an array, with a line like this: int a[5]; Then, the number between the brackets is the total number of elements in the array (in the above, it's 5). When …

Member Avatar for rubberman
0
311
Member Avatar for Dani

I tried to post while logged out, it didn't work (using Chrome if that matters). I never seem to pass the "are you human" questions, which I think is wrong, unless I'm actually a robot.

Member Avatar for Dani
0
81
Member Avatar for benclifford

AD's right. The problem is probably with the return values of the set functions. I don't see anything else that could be wrong. Basically, if you don't return a value, then that creates an uninitialized value. This is simply because the memory for the return value is normally pre-allocated before …

Member Avatar for benclifford
0
388
Member Avatar for subith86

This happened to me a couple of times before, usually after switching to an experimental version of GCC from the svn development branch. Switching to a stable release or a newer version should fix the problem. This is definitely a problem with the compiler (GCC is usually pretty bug-free, but …

Member Avatar for mitrmkar
0
3K
Member Avatar for ddm

Imagine I'm the user of your class. I'm not interested in knowing about T0 or T1. I don't care about how the class keeps the time periods. All I want is a clear way to use the class, e.g., start, stop, and get elapsed time. Thus far, your implementation seem …

Member Avatar for mike_2000_17
0
153
Member Avatar for mayankwasekar

English please. $ sudo mount -t ntfs -o defaults /dev/sda5 /mnt/my_drive where `/dev/sda5` must be replaced by your hard-drives name, and `/mnt/my_drive` must be replace by whichever folder you which to mount the hard-drive into.

Member Avatar for Nimrod7676
-3
183
Member Avatar for nuclear

"C# is like a newer version of C++" -- Microsoft's Ministry of Public Enlightenment and Propaganda Here goes another rant: C#, like most other programming language that came after C/C++, has a syntax that is largely based on or similar to C/C++. This is purely to ease the adoption of …

Member Avatar for mike_2000_17
0
162
Member Avatar for nuclear

Nobody wants to pay someone to learn, unless it's for a permanent position (learn for a while and then be a productive employee for several years). Your level of experience, as you described it, is minimal, you still have a long way to go kid. Your best bet is probably …

Member Avatar for nuclear
0
287
Member Avatar for ChaseRLewis

If you hold an array of Y objects, then you can only store Y objects in it, nothing else. When you do `stuff[0] = Z();`, what you are really doing this is: create a temporary Z object, and then assign a Y object (the first in the stuff array) to …

Member Avatar for ChaseRLewis
0
154
Member Avatar for ChaseRLewis

I think you are a bit confused about how instructions are executed on a virtual machine. The "stack" is not a stack of instructions, that's why you are confused on how to set it up. The instructions themselves are more appropriately stored in a queue or stored in a random-access …

Member Avatar for mike_2000_17
0
191
Member Avatar for stereomatching

There have been some attempts at combining GIL and OpenCV, and two distinct projects on the GIL website are about the development of such an extension, see [here](http://opensource.adobe.com/wiki/display/gil/Contribute+to+GIL). I wouldn't exactly qualify OpenCV as a well designed library (much less than GIL), but it certainly is very feature-rich. The OpenCV …

Member Avatar for stereomatching
0
165
Member Avatar for usustarr
Member Avatar for rubberman
0
171
Member Avatar for _Nemesis_

The Boost Graph libraries have an implementation of `A*` (and Dijkstra if you want) which both rely on a priority queue implementation that has more capabilities than the standard priority queue. Their priority queue implementation is also indirect which is also helpful. It supports functions like `push_or_update`, `update`, and `contains` …

Member Avatar for _Nemesis_
0
1K
Member Avatar for Labdabeta

The most usual storage is in RGBA (usually the default in many places) and sometimes you see BGRA (used in TGA image formats, and some Mac or Adobe formats). As for big-endian versus little-endian, it doesn't really matter when you are getting the data from a file. In a file …

Member Avatar for Labdabeta
0
697
Member Avatar for triumphost

It's not very clear what you are looking for, but here are a few suggestions that might be in the ball-park of what you are looking for: You can ask the compiler to produce an "assembly listing" (assembly listings are text-form assembly code, like the snippets that you posted) instead …

Member Avatar for mike_2000_17
0
308
Member Avatar for nuclear

The model-view matrix will always be applied to the vertices, so it makes no difference (speed-wise) whether the transformation is the identity matrix or whether it has any transformations accumulated in it (rotations and translations). OpenGL is given a model-view matrix and a set of vertices, and it will apply …

Member Avatar for nuclear
0
264
Member Avatar for Ahmed2

Definitely, store them by value in the list, i.e. as `list<FileInfo>`. One advantage of linked-lists is that it almost never has to copy elements of the list (when inserting / deleting). So, you won't get any real penalty for storing a fairly large object by value in the list, if …

Member Avatar for mike_2000_17
0
232
Member Avatar for compsci91

Using a forward-declaration. A forward-declaration is a way to declare a class or function before its full declaration or definition can be written. There are restrictions on how you can use the class or function before its actual declaration or definition appears. In case of a forward-declared class, because the …

Member Avatar for mike_2000_17
0
126
Member Avatar for nuclear

You load the model, which usually includes values for the vertex coordinates, the normal vectors, the texture coordinates, and the color values, associate to each vertex. Then, you load the texture corresponding to the model, and you apply both. You never hard-code anything, you write code to load everything from …

Member Avatar for mike_2000_17
0
199
Member Avatar for C0ding

You open the terminal window and issue this command: $ sudo apt-get install flashrom upx That's all.

Member Avatar for C0ding
0
1K
Member Avatar for TheWind147

This means you have to create a second array of the same size as the one to be sorted, and pass that second array as the "temp" parameter to the merge sort function.

Member Avatar for TheWind147
0
332
Member Avatar for C0ding

First of all, to add anything to the iso, you of course have to be able to open it and edit it. I assume you know how to do that. One other option is to create a bootable USB stick from the ISO, and then add your stuff to that …

Member Avatar for C0ding
0
184
Member Avatar for nuclear

I think the guy in the tutorial made a mistake. What he is describing does not correspond to a rotation about the x axis. It seems to correspond to a rotation about the y axis (vertical). If you apply a rotation of -90 degrees about the y axis, you will …

Member Avatar for nuclear
0
4K
Member Avatar for MasterHacker110

@AD: The docx format is not really a binary format, it is just a zipped xml file. You can decompress it with a standard zip library and then read / write it with any decent xml library, plenty of those are available in C/C++.

Member Avatar for mike_2000_17
-1
183
Member Avatar for MasterHacker110

Assembly, C and C++ are by far the most prevalent in that matter. I don't think there is any OS that is written with any other language. By far, it is dominated by C. Some lower-level details might be done in Assembly, and some higher-level parts might be done in …

Member Avatar for mike_2000_17
0
141
Member Avatar for jeanbarca

We're not going to do your homework for you. You need to show some efforts of your own towards solving this problem. Btw, the function you need for sorting an array is [`std::sort`](http://www.cplusplus.com/reference/algorithm/sort/). And your multiple sorting criteria is called a [lexicographic ordering](http://en.wikipedia.org/wiki/Lexicographical_order) (e.g. alphabetical ordering is a kind of …

Member Avatar for jeanbarca
0
308
Member Avatar for MR_88

Ahh, good old bug-riddled GSL! If I had a dime for every bug in GSL, I'd be a rich man. Obviously, the problem is that you run out of memory. Meaning you have a memory leak in a loop. If you call the above function within a loop without freeing …

Member Avatar for zp0402
0
1K
Member Avatar for c3r3alki113r

Your random generation function is wrong. First, you should not seed the random number generator every time you query for a number. You should only seed it once at the start of the main() function. Also, your range computation in it is also wrong. You had this: ~~~ double ranDec(int …

Member Avatar for c3r3alki113r
0
207
Member Avatar for Labdabeta

Rendering Bezier patches or NURBS surfaces isn't hard at all in OpenGL, not any harder than rendering a vertex buffer (the procedure is similar, you hand over the points to OpenGL and you call a render function on it). I suggest you [look into it](http://www.glprogramming.com/red/chapter12.html).

Member Avatar for Labdabeta
0
525
Member Avatar for Dani

I generally like the new editor and the markdown. It's not only simpler but also more feature-rich (at least it seems at first glance), which is a nice combination. But I have a few beefs: 1. The transition messed up some previous posts. For example, I wrote [two](http://www.daniweb.com/software-development/cpp/tutorials/378692/beginning-c0x-design-of-ownership) [tutorials](http://www.daniweb.com/software-development/cpp/tutorials/373787/beginning-c0x-making-a-raii-class) on …

Member Avatar for Dani
0
526
Member Avatar for needforkevin

I think that line 130 should be: for (int j=n-1;j>=pass;j--) // notice 'n-1' instead of 'n-j'.

Member Avatar for needforkevin
0
244
Member Avatar for cryonize

A lot of things are wrong with your code. First of all, you have things that are just useless, like these types of things: if(min->NEXT != NULL) i->NEXT = min->NEXT; else i->NEXT = NULL; Tell me how that is different from this: i->NEXT = min->NEXT; ??? (rhetorical) Second, your code …

Member Avatar for Nick Evan
0
591
Member Avatar for murnesty

First of all, there is no point in using the volatile keyword on a variable that is not shared between more than one thread. The whole idea of a volatile variable is to tell the compiler that this variable could change value at anytime, in parallel to the thread of …

Member Avatar for mike_2000_17
0
127
Member Avatar for deval90

You should probably start by reading the instructions: "**use a class with 3 member functions** named InputMatrix, Calculate, and OutMatrix. ... **no global variables allowed**." You have some problems with your code, but they will be solved if you follow those highlighted instructions. [This tutorial](http://www.cplusplus.com/doc/tutorial/classes/) might help you.

Member Avatar for mike_2000_17
0
264
Member Avatar for pjh-10

All your prof wants of you is that you compute the function given [here](http://en.wikipedia.org/wiki/Birthday_problem#Average_number_of_people) for M = 1000. It requires a loop and a few basic math operations. So much ink has been spilled on this issue, it's crazy. Forget all the random shuffling business. This is a just about …

Member Avatar for pjh-10
0
443
Member Avatar for Nathaniel10

If you want to improve performance, you need to implement this as a [ring buffer](http://en.wikipedia.org/wiki/Circular_buffer). Also, your indentation scheme looks a little weird. And, obviously, you shouldn't use global variables. Learn to create classes and use objects. Finally, you include a header `std_lib_facilities.hpp`, I assume this header includes a number …

Member Avatar for Nathaniel10
0
87
Member Avatar for dark_sider_1

I would try with negative Z values. Without rotations applied, the Z-axis points towards you (from the screen and out), with the zero being at the screen. This means that anything you draw in the positive-Z area is not going to appear on the screen (it is "behind" the camera). …

Member Avatar for mike_2000_17
0
979
Member Avatar for dark_sider_1

You also should take a look at [Shader Designer](http://www.opengl.org/sdk/tools/ShaderDesigner/). This is an IDE for GLSL, I've used it in the past when I played around with shaders, it's pretty nice and easy. I think it also provides base codes to start from.

Member Avatar for dark_sider_1
0
282

The End.