6,741 Posted Topics
| |
Re: >I know it's good programming practice to make >accessor's const. But does it impact speed. It can, but usually nowhere close to as much as many people believe. const is more for your benefit because it helps make your code easier to work with by adding compile-time invariants. >Will I … | |
Re: >that is the code for decimal to binary... That's pretty awful. At least it kind of works. >#include <conio.h> You don't even use anything from this header, why destroy portability by including it? >void main() Here is the only correct definition of main with no parameters: [code=c] int main ( … | |
Re: >The first one is I'm wondering what is the best library to use for a hash table in a C++ It depends on what you need. Google's sparse hash library is nice, and if you can find a good implementation of TR1 (such as Dinkumware), you can use the hash_set … | |
Re: >so my qusetion is that :I need to know how many >the libraries under C language until this day.. ? It sounds like you just want to focus on Win32 for now. You can start [url=http://winprog.org/tutorial/]here[/url], but eventually you'll be checking [URL="http://msdn.microsoft.com/en-us/library/aa139672.aspx"]MSDN[/URL] regularly. Note that GUI programming is not easy … | |
Re: That's a classic error. It means you created a Win32 application project but wrote code for a console mode application. The former requires WinMain instead of main as the entery point. | |
Re: >Do you think that an old compilator can differ a magnitude order from the new one? Yes. Especially since Visual C++ 6.0's STL implementation was extremely weak. >Can I do easily a dll for windows without using Microsoft Visual C++ compilator? Writing DLLs in Windows is not difficult. Though I … | |
Re: [QUOTE=jephthah;671431]i thought this thread was about "strangling newbies" imagine my dismay when i found a ten-mile long post full of incoherent code with no syntax coloring.[/QUOTE] That was completely uncalled for, jephthah. If you're going to take the path of the angry programmer, at least try to follow the lead … | |
Re: The condition must evaluate to a boolean type. Unless result[i][1] is already a boolean type, you can't use it without a relational test: [code=csharp] String str = ( (String)result[i][1] != null ? (String)result[i][1] : "" ); [/code] Also, what type is result[i][1] such that a cast to String is required? | |
Re: Have you looked into using templates for your containers? | |
Re: Viewing the "machine code" is pretty much a silly idea. More likely you want to see the assembly code that corresponds to the machine code. In that case there are two easy ways depending on whether you have the C++ code available or not. If you have the source code, … | |
Re: >#include<conio.h> I recommend you forget this header exists until you learn why it's a bad idea. >void main() main returns int. >char *typed; >gets(typed); That's just brilliant. Not only did you fail to allocate memory to typed (who knows where those characters are being written), you chose to use gets … | |
Re: >Hello guys this is my code. It's not often that looking at code can leave me speechless. >Can anyone help me please??? Sure. Let's start by looking at the fatal errors: >char str[] = { 0 }; As much as many C programmers would love for this to declare a … | |
Re: >I'm a CS student and as far as my experience tells me I'm thinking you need some more experience if you can't tell that 2004 was two years ago. | |
Re: As I understand the issue, Dani isn't against an automated solution as long as it's generalized. Every time we bring up the issue, she asks us for a good way to handle checking for code tags with every language that Daniweb has a forum for. A good suggestion has yet … | |
Re: >I ended up having to do some research on why the cast the >OP mentioned was legal, and I admit I still do not understand. Put simply, the cast is an "I know what I'm doing" switch that turns off the safety net. In this case, and on the OP's … | |
Re: >I run the code on a linux machine and gave me errors.. What errors? Posting your code and your assignment isn't conducive to getting help because it suggests that you want us to finish your project for you, which isn't going to happen. | |
Re: >whether it's attributable the to size of the class or not I don't know Only actual data (explicit data members, hidden data members, and padding) adds to the size of an object in memory. Member functions are stored elsewhere, and not duplicated for each object. | |
Re: I have no idea what you just asked. Be more specific. | |
Re: >At least that's how my reference explains it. You might be misunderstanding your reference. There's an implicit conversion operator and a function call operator The function call operator is a general member function in terms of return value and parameters. The implicit conversion operator takes no parameters ([ICODE]*this[/ICODE] is implied) … | |
Re: [QUOTE=elite1986;497723]I do not meet that command . You can use for small files < 3.2MB; char *t; FILE *fp; fgets( t, 32767, fp);[/QUOTE] How did you come up with 32767? If your files are smaller than 3.2MB, you still have to account for up to 3.2MB, which is 3355443, not … | |
Re: >I get no errors but nothing happens when I click the button. I'm guessing that something does happen, but since you don't do anything that produces a noticeable effect, it seems like nothing is happening. | |
![]() | Re: The only standard method is the system function: [code] #include <cstdlib> #include <iostream> int main ( int argc, char *argv[] ) { if ( argc < 2 ) { std::cerr<<"Too few arguments"<<std::endl; return EXIT_FAILURE; } // Be ultra-anal if ( std::system ( 0 ) == 0 ) { std::cerr<<"No command … |
Re: >My favorite games are Zelda: OOT, Chrono Trigger/Cross, Xenogears, al Final Fantasies, and Earthbound. I like you already. :) Might I also suggest Xenosaga, Lunar, Lunar 2, Wild Arms, Tales of Destiny, and Tales of Symphonia? >I compile it and it says that there is an error. The code is … | |
Re: >i just can't imagine it being really THAT hard of a feature to implement. It's not. In fact, I believe it's a feature of vBulletin if you choose to enable it. >i really wish threads that have been inactive for >more than 90 days would be automatically locked. I don't. … | |
Re: >what programmers use it for in real-world programs such as system, applications, etc. Recursive descent parsing comes to mind. >Parse binary trees Actually, my experience is that nearly every recursive algorithm when working with binary trees is better written iteratively. This improves the performance[1], footprint guarantees[2], reliability[3], and flexibility[4]. [1] … | |
Re: >I'd like to know what pisses you off about DaniWeb? The fact that each page is noticeably slow to load (between 1 and 4 seconds for threads and just enough to throw me off on the main forum list), even with ads disabled. This wouldn't be nearly as frustrating if … | |
Re: >Then use sscanf() to read that string into an int previously declared. If you're already validating the string, sscanf is overkill. If it's a valid integer you can use atoi safely. Or better yet, you can combine the conversion and the validation with strtol: [code=c] #include <errno.h> #include <stdio.h> #include … | |
Re: When all pertinent information has been discussed, and it appears that future posts will only cause trouble. | |
Re: unsigned char and char are different types. ncb_callname should probably be of type char (I assume it's an array) rather than unsigned char. | |
Re: >I have little chance of actually getting anywhere in the game development >industry - because I am not getting a degree that is specifically game related. I'd say your friend is full of it. Ability trumps education every time, and the gaming industry is especially well-known for turning basement coders … | |
Re: Or offer the option to turn that feature off in one's control panel. I personally would use it because I always preview before posting anyway. | |
Re: >I keep hearing that Python is about as slow as Java. Java can be comparable in speed to C++ or as slow as Christmas. It's not a good measure. >Does anybody have experience with speeding things up? Are you having problems with performance? If not, why bother? In my experience … | |
Re: Wow, that guy looks like a lot of fun. What IRC server/channel was that in? :) But yes, hacking can mean writing. There are multiple definitions of "hacking", and one of those is skillfully writing programs (or kludges, depending on the context). | |
Re: I disagree, of course. Quality is paramount even when doing incremental releases. The increments refer to feature sets, not bug fixes. | |
Re: It's a good think you posted your code before it passed 1000 lines, otherwise we might complain that it was too long... | |
Re: >But where I worry about it the age of the book No worries, the contents are still relevant. | |
Re: >You're getting C++ errors. C++ is a lot stricter. Try using a C compiler. So your advice is to ignore the warning and let the problem silently continue. Brilliant. :icon_rolleyes: >"cannot convert from" is a C++ (and in general, OOP) only error afaik. You get it in C as well … | |
Re: Break the problem down into manageable pieces, then solve each one individually. That should minimize the smothering effect of a complicated problem and you'll end up with specific questions that we can answer and specific problems that we can help with. Asking for "help right from the scratch" suggests that … | |
Re: >I do not know if my code will be portable when I start learning it. It won't be. Assembly languages are only portable to the processor family (and depending on the features you use, the family subset) they're implemented for. >Do other Assembly languages conform to the same standards The … | |
Re: That usually happens to me when I forget to close the output window for a debug run. | |
![]() | Re: >but it gives a floating point format not linked error. Wow, I haven't seen that error in a [b]long[/b] time. It used to be a [url=http://www.eskimo.com/~scs/C-faq/q14.13.html]frequently asked question[/url], maybe you should get a newer compiler. >How do i convert the coordinate values to those that could be outputted by the … |
Re: >1. Pointers increase the efficiency of our programs They also decrease the efficiency of programs. >2. Pointers degrade reliability of C++ programs due to security issues Only if used improperly, just like any other language feature. | |
Re: Seen it, many times over, on several versions of Windows. That joke is officially old and tired, but I expect we'll see it on every version of Windows in the future as well. | |
Re: >in the second implementation the MyException object >is allocated on heap, but how about the first one? It's unspecified: [quote=C++0x Draft] 3 A throw-expression initializes a temporary object, called the exception object, the type of which is determined by removing any top-level cv-qualifiers from the static type of the operand … | |
Re: It means you probably wrote to memory you don't own, perhaps by overrunning a buffer, freeing memory more than once, or forgetting to initialize a pointer before using it. | |
Re: >But what I can't seem to access is the constructor. This is where the C memory functions fall flat, they don't work well with constructors and destructors. I recommend ditching calloc and using new[]: [code=cplusplus] CObject *group = new CObject[N]; [/code] Or better yet, use the vector container class if … | |
Re: Your question is vague enough that if you have special needs, a direct answer isn't going to be what you want (especially since the most direct answer is "What have you tried?"). So how about you tell us exactly what you're doing so we can offer more appropriate advice. |
The End.