#133578 - HyperHacker - Sat Jul 07, 2007 5:56 am
I thought using C++ with -fno-exceptions and -fno-rtti was supposed to not increase your program's size? Mine went up 33K after converting and adding a class with no code in it yet. :-/
_________________
I'm a PSP hacker now, but I still <3 DS.
#133579 - NEiM0D - Sat Jul 07, 2007 6:13 am
You can get a binary written in C++ for DS down to ~1K, see http://www.osdev.org/wiki/C_PlusPlus for tips.
The key idea is that you write most of the code yourself.
#133582 - StoneCypher - Sat Jul 07, 2007 6:38 am
1) you don't need to write anything yourself to get tiny C++ output.
2) that cxa pure virtual they use is illegal. see http://sc.tri-bit.com/DsOut for details.
3) that page says very little about reducing the size of code.
4) take advice from neimod about c++, i dare you
There's a lot more to turn off than RTTI and exceptions. Try getting a compiler manual. Stripping a C++ compiler down isn't easy.
As far as "no extra overhead," well, that's only if you're willing to go to the effort of swapping out newlib for a smaller runtime. (Doubtless neimod will claim this is what he meant by "writing it yourself," which is why vague things make some people think they sound smart.) Unfortunately, writing a C or C++ runtime is neither quick nor easy (which is why people shouldn't give advice about things they've never done,) and with all due respect, if those are the only two things you turned off in your compiler, you're not ready to write a runtime.
You can trim DKP C++ with newlib in standard config down to about 56k. If you want to go smaller than that, you have to start getting familiar with the tools under the surface.
Maybe more importantly - why are you worried about the space? Does it really matter?
_________________
Quidquid Latine dictum sit, altum Sonatur
[Images not permitted - Click here to view it]
#133583 - HyperHacker - Sat Jul 07, 2007 6:41 am
I'm trying to keep my program under 256K in the hopes that it can eventually be a firmware replacement. What you describe sounds painful though. Maybe I'll just not use classes. >_>
Also I saved 26K by using siprintf() in place of sprintf() and the like. Yay.
Although, if I do decide to use C++ later, is there a way to turn off that compiler warning about comparing signed and unsigned variables? <_<
_________________
I'm a PSP hacker now, but I still <3 DS.
#133584 - StoneCypher - Sat Jul 07, 2007 6:53 am
Quote: |
I'm trying to keep my program under 256K in the hopes that it can eventually be a firmware replacement. |
The vast majority of the people I've seen give up on DS development did so because they started too big. Maybe write a small game before you move on to firmware replacements. That's kind of above your apparent level, no offense intended.
Quote: |
What you describe sounds painful though. Maybe I'll just not use classes. >_> |
That would be an unfortunate choice, but it's your call what to do.
Quote: |
Also I saved 26K by using siprintf() in place of sprintf() and the like. Yay. |
You could save more by eliminating printf entirely than you would moving from C++ back to C.
Quote: |
Although, if I do decide to use C++ later, is there a way to turn off that compiler warning about comparing signed and unsigned variables? <_< |
No. That's a serious mistake. Instead of trying to suppress the warning, maybe just fix it. Either typecast the variable or stop mixing signed and unsigned.
unsigned int foo = static_cast<unsigned int>(mySignedInt);
_________________
Quidquid Latine dictum sit, altum Sonatur
[Images not permitted - Click here to view it]
#133601 - simonjhall - Sat Jul 07, 2007 11:41 am
You should be able to get g++ to output the exact same size code as regular gcc, assuming you've got no C++ in there.
I ported Quake from C to C++ and the size went right up, however after using -fno-exceptions and -fno-rtti (as you said) the binary popped out the same size in the end.
If you are in fact getting bigger output (how much bigger?), you could try building it twice - once in C and once again in C++ (assuming you can), stripping the two sets of object files and then comparing them to see which object files are bigger. Once you can see which files are bigger, it's not too hard to step in there with nm and objdump to see what exactly is getting done in your files!
_________________
Big thanks to everyone who donated for Quake2
#133604 - Quirky - Sat Jul 07, 2007 12:48 pm
A class with no code still may generate the default constructor, destructor, copy constructor and assignment operator. 33k seems a bit much though!
#133621 - HyperHacker - Sat Jul 07, 2007 8:24 pm
By "no code" I mean it had empty con/destructors and 4 empty functions. I'll try that, simon, but it looks like I can get away with just using C for this project.
StoneCypher wrote: |
Quote: | I'm trying to keep my program under 256K in the hopes that it can eventually be a firmware replacement. |
The vast majority of the people I've seen give up on DS development did so because they started too big. Maybe write a small game before you move on to firmware replacements. That's kind of above your apparent level, no offense intended. |
I know, it's a big project and may never get that far. It's nearly ready for a beta release as a standalone .nds though. I may not have released much for the DS, but I'm no n00b to coding. (Though I mainly taught myself C, so some of my habits may be kinda dumb, it just worked and I went with it.) I'd direct you to my website to see the things I've made before, but it's down. :-(
Quote: |
Quote: | What you describe sounds painful though. Maybe I'll just not use classes. >_> |
That would be an unfortunate choice, but it's your call what to do. |
Well it looks like what I was going to use them for can be accomplished easier by just cleaning up the code and separating some large routines into several small ones.
Quote: |
Quote: | Also I saved 26K by using siprintf() in place of sprintf() and the like. Yay. |
You could save more by eliminating printf entirely than you would moving from C++ back to C. |
You mean just printf() or all of ?printf/?scanf? I don't actually use printf(), I use a custom console library (to be released with the beta) which is currently ~39.5K and can probably be reduced a fair bit.
Quote: |
Quote: | Although, if I do decide to use C++ later, is there a way to turn off that compiler warning about comparing signed and unsigned variables? <_< |
No. That's a serious mistake. Instead of trying to suppress the warning, maybe just fix it. Either typecast the variable or stop mixing signed and unsigned.
unsigned int foo = static_cast<unsigned int>(mySignedInt); |
I guess so, it's just that I've done it plenty of times before and not had a problem. It's usually dumb things like this:
for(i=0; i<NumFiles; i++)
where i is signed and NumFiles isn't (both 32-bit integers); it may fail if you have 2 billion files but at that point things like memory and other programs failing would be bigger issues. Having to cast them all the time can make for some ugly code.
_________________
I'm a PSP hacker now, but I still <3 DS.
#133624 - StoneCypher - Sat Jul 07, 2007 8:45 pm
Quote: |
A class with no code still may generate the default constructor, destructor, copy constructor and assignment operator. 33k seems a bit much though! |
It's not those that are causing the space increase; indeed, in such cases, all four of those members will point to the same empty stub function, which in the GCC CPPRT are called __cxa_non_virtual(...) or __cxa_pure_virtual(...) depending on how you have RTTI set up.
The space increase comes from the C++ runtime library. In a weird way, Simon Hall is kinda-sorta-correct: he's passing C to g++, and getting the same size as passing it to gcc. This is relatively amusing, because g++ is just a wrapper to gcc which passes in some information along the lines of "if you see c++ or a specific set of file extensions, start compiling as C++ instead." If Simon would take the time to look into his ELF map, he'd discover that the reason his binary is the same size as a compiled C binary is because he made a compiled C binary; he's not making the comparison he thinks he's making.
There is a fundamental size increase to C++ over C that you cannot eliminate. Just how big that size increase is depends on the library implementations and the runtime implementations you use; the C++ runtime in GHOC is about 1.4k larger than their C runtime when everything but RTTI and exceptions are turned on, and that's the smallest change I'm aware of. I believe that the current set of libraries and design choices in DKP make the number something closer to 33k, though Wintermute is likely to know for certain.
That size increase is pretty plain: it's the code that calls the constructors on globals, that performs cleanup in C atexit(), that handles static allocation, that manages the placement delete segments, that contains the extra behavior for new above malloc, and so on and so forth. I mean, there are just more things that the C++ runtime does than the C runtime does, in order to support those tools in C++ that do not exist in C; the binary size increase you're seeing is (in part) about that.
And yes, it could be smaller. If you want it to be smaller, you'll need to replace newlib, like I was saying before. Newlib is the specific choice of C++ runtime (sorta) that DKP is using, and it's partially responsible for that increase in code size.
That all said, look, HyperHacker wanted to know how to suppress type conflict warnings in his comparisons. He doesn't know about casting. He's not really going to write a firmware replacement, and frankly I don't think anyone would even do that in C. There are, maybe, five people in this community who could actually pull a project like that off, and that's only after a serious amount of reading; I don't think any of us could do it from a cold start, and I've done it before, so when I say I couldn't do it from a cold start, you need to hear how difficult that means this is.
And besides, the idea that it should be done with the C or C++ runtimes in place shows a dangerous level of naivete: the firmware has to be hard realtime, and neither the C nor C++ runtimes in DKP are; this risks stack faults, which could have literally any behavior, and it's not tremendously unlikely that such a flaw, since it's in firmware, would end up bricking the console.
Stick to Tetris until you're 2000 pages into industrial design reading, guys.
_________________
Quidquid Latine dictum sit, altum Sonatur
[Images not permitted - Click here to view it]
#133626 - StoneCypher - Sat Jul 07, 2007 8:54 pm
Quote: |
I may not have released much for the DS, but I'm no n00b to coding. (Though I mainly taught myself C, so some of my habits may be kinda dumb, it just worked and I went with it.) |
With all due respect, nothing in software engineering is more dangerous than a programmer who doesn't understand the serious errors they make. There's a big difference between "I don't see my bugs" and "I'm no noob."
Yes, sir, you are, in the extreme.
Quote: |
Although, if I do decide to use C++ later, is there a way to turn off that compiler warning about comparing signed and unsigned variables? <_< |
I don't mean it to be disrespectful; we were all noobs at one point, and more than half of us still are. That said, look, you need to face the truth: you do dangerously incorrect things, and you fail to understand basic principles of the language. You really, really need to follow the advice you got from everyone speaking when you were on IRC, and pick up an intro to C++ book. I'm not trying to be a dick, I'm trying to get you past a personal inhibition and to move you towards progress.
You have shocking misconceptions about the language. You're doing things that are provably incorrect. There's undefined behavior all over your code. You would not pass a CS 110 class.
You need to accept that you're a novice, and to start working on fixing that, instead of to continue to charge blindly ahead. People who insist on doing it the way they taught themselves, instead of learning to do it right, turn into Tepples.
Do you really want to be a Tepples-style engineer?
http://en.wikipedia.org/w/index.php?title=Special%3ABooksources&isbn=9780201703535
[Wikipedia > retailer -- MOD]
That's your salvation. Take it before it's too late. Note there's no amazon referral link; I'm not trying to make money off of you. I'm trying to prevent the formation of a new Tepples. The forum is burdened enough with stupid already, and that kind of clash of titans could tear the universe to shreds.
_________________
Quidquid Latine dictum sit, altum Sonatur
[Images not permitted - Click here to view it]
#133637 - simonjhall - Sat Jul 07, 2007 10:15 pm
off topic:
Wow, this is quite some thread. These pages and pages of text do not at all help out our friend here who has big binaries. It's nice linking in books - and I'm sure that they may help in the long run - but pissing about with your DS is also a valid way of learning, as you get the practical knowledge you wouldn't get if you were just reading a book.
Also - I just have to ask - what's with the attitude? You're obviously a smart guy and you definately know your stuff, but why not help people with a more positive attitude than just coming down on people like you do? If you get so easily upset by people making mistakes, why bother come here?
If you were asking for help, would you want someone acting like this towards you? Putting "with all due respect" doesn't nullify the rest of your posts.
And yeah, I've avoided being in your firing line up to now and I don't personally have a problem with you (as you've never said anything bad to me) but I'm risking it just to find out why you're always unhappy when you post.
@ tepples, why did your posts go walkies? I think you had a point about taking the meaning of "the same" too literally
@ mods, feel free to delete this
EDIT: I've just seen where the rest of this discussion in the C++ forum, but I still would like an answer to my question
_________________
Big thanks to everyone who donated for Quake2
#133642 - tepples - Sat Jul 07, 2007 10:34 pm
simonjhall wrote: |
Also - I just have to ask - what's with the attitude? |
I'm confused about myself. What changes should I make to my attitude?
Quote: |
You're obviously a smart guy and you definately know your stuff, but why not help people with a more positive attitude than just coming down on people like you do? |
Should I express all my observations in the form of either a test case or a question?
Quote: |
@ tepples, why did your posts go walkies? I think you had a point about taking the meaning of "the same" too literally |
There were some posts about the difference between class and struct in C++ and the lack of such a difference under common practices, peppered with misunderstandings on possibly both our sides. I split them out to the C/C++ forum, where I guess that language esoterica stuff that doesn't relate specifically to the DS belongs.
Anyway: Each feature of C++ has overhead. Some features have more overhead than others, and a language attorney licensed to practice in your jurisdiction will give you a more reliable answer. If you can justify the overhead of a feature, go ahead and use the feature. Otherwise, don't.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#133644 - simonjhall - Sat Jul 07, 2007 10:37 pm
Those questions were aimed at StoneCypher! Not you! I have no beef with you :-)
_________________
Big thanks to everyone who donated for Quake2
#133645 - Dood77 - Sat Jul 07, 2007 10:39 pm
EDIT: In the time I was writing this post, three more posts were made... Heh, oh well.
StoneCypher wrote: |
There's a big difference between "I don't see my bugs" and "I'm no noob." |
StoneCypher wrote: |
we were all noobs at one point, and more than half of us still are. |
If you don't remember, noob comes from newbie, the root being new. HyperHacker was saying he's not new to coding, he just admittedly has some bad habits.
"Noob" is in the eye of the beholder. If you call HyperHacker a noob, what the heck would you call me, who doesn't know a lick of C besides printf and scanf in a command window?
StoneCypher wrote: |
I'm trying to get you past a personal inhibition and to move you towards progress. |
StoneCypher wrote: |
That's your salvation. |
Well, aren't you a saint? Please stop acting like you're the only one who can help HyperHacker, you've stated your advise to him, that is to read more up on beginning C++, I don't think you need to persuade him anymore. If he wants to follow it, he will make the decision to.
StoneCypher wrote: |
People who insist on doing it the way they taught themselves, instead of learning to do it right, turn into Tepples. |
StoneCypher wrote: |
I'm trying to prevent the formation of a new Tepples. The forum is burdened enough with stupid already |
StoneCypher wrote: |
I'm not trying to be a dick |
Let me just put those few quotes together, as well as keep in mind the next quote too.
I'm not saying you're wrong in any of this technical C stuff, neither am I saying that tepples is right. Just to please keep consistent in things you say, and stop interpreting things people say in a way to deliberately create the opportunity to bash someone else. (I'm refering to how you interpreted 'the same as') I think we can all agree to keep to the facts and lose the unnecessary flaming. We all know by now of your dislike of tepples, which I daresay is off-topic to this thread, section, and entire forum.
StoneCypher wrote: |
Do you really want to be a Tepples-style engineer? |
Obviously I'm assuming you mean for HyperHacker to not want to become like tepples, and for him to have scorn for his "engineering style". As far as I know, HyperHacker respects tepples. Yet, I also don't think he wants to idolize him.
StoneCypher: I took a little look at this book (ISBN 9780201703535) and the editorial review mentions it's good even if you don't know any or minimal C. Would you recommend it to me, who's first programming was TI-83 BASIC in 8th grade? I've since learned intermediate q-BASIC (and freeBASIC, open-source, win32 clone of QB), a small chunk of pHp, nothing with mySQL yet though, and a small bit of javascript.
I basically know nothing of pointers, memory addresses, assembly, hexadecimal coding, etc. Though I do well in math, I'll be in calculus next year as a senior in high school. (If you reference that as evidence of my maturity level then this will continue to be a flame war.) So anyway, would you recommend that book as an introduction to C/C++? Or would a beginning C book be more appropriate?
_________________
If I use a term wrong or something then feel free to correct, I?m not much of a programmer.
Original DS Phat obtained on day of release + flashme v7
Supercard: miniSD, Kingston 1GB, Kingston 2GB
Ralink chipset PCI NIC
#133646 - tepples - Sat Jul 07, 2007 10:48 pm
There is a big difference between a "newb" and a "noob". Posts at physicsforums and at rottentomatoes begin to explain the difference.
Still, many C++ books really are to the point where one can skip C. Reading the review of the book at Amazon leads me to believe that it should be appropriate for your skill level if you want to take up C++. If you want a C book, such as if you will be programming for a platform such as the GBA or the DS ARM7 that can't tolerate the overhead of a lot of C++'s features, get a C book.
But I thought that when linking to a book, one was supposed to give the ISBN, possibly with a link to Wikipedia's Book Sources page, not a link to a retailer.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#133655 - HyperHacker - Sat Jul 07, 2007 11:19 pm
StoneCypher wrote: |
That all said, look, HyperHacker wanted to know how to suppress type conflict warnings in his comparisons. He doesn't know about casting. |
K, now you're just being a dick. Assumptions are bad. As I stated, adding casts all over the place to prevent a problem that's never going to occurr is just going to make the code ugly and hard to read. If x is a 32-bit unsigned integer that is never going to come close to 0x7FFFFFFF, who cares if I'm doing for(i=0; i<x; i++) with i being signed?
Quote: |
He's not really going to write a firmware replacement, and frankly I don't think anyone would even do that in C. There are, maybe, five people in this community who could actually pull a project like that off, and that's only after a serious amount of reading; I don't think any of us could do it from a cold start, and I've done it before, so when I say I couldn't do it from a cold start, you need to hear how difficult that means this is. |
Yes, of course I'm going to have to read up on some things before I go about writing to the firmware chip. I may never even try for fear of bricking the system. So what? Most people here don't know how to write a firmware replacement because they haven't bothered to learn how because they don't want to write one.
Quote: |
And besides, the idea that it should be done with the C or C++ runtimes in place shows a dangerous level of naivete: the firmware has to be hard realtime, and neither the C nor C++ runtimes in DKP are; this risks stack faults, which could have literally any behavior, and it's not tremendously unlikely that such a flaw, since it's in firmware, would end up bricking the console. |
Of course if I do this I'll be doing a fair bit of ASM work. Hell I'll probably compress the executable and have a small stub loaded to decompress it from NVRAM.
Of course I'm not going to say "ok program's done let's flash it in lololol". I wouldn't dream of having it act as firmware until the standalone version has been extensively tested by the community.
"Hard realtime" is a new one to me, so let's ask Google:
Quote: |
IFAIK a "Hard" real-time OS is an Operting System in which the worst-case execution time of the system calls is either known beforehand or computable based on the how the application is configured (aka no. of threads, no. of interrupting sources, their periodicity) etc.. but I have not been successful. |
System calls? Last I checked, those are in the BIOS. The firmware is removed from memory, save for user settings, once the DS card is booted. Is this not correct?
StoneCypher wrote: |
Quote: | I may not have released much for the DS, but I'm no n00b to coding. (Though I mainly taught myself C, so some of my habits may be kinda dumb, it just worked and I went with it.) |
With all due respect, nothing in software engineering is more dangerous than a programmer who doesn't understand the serious errors they make. There's a big difference between "I don't see my bugs" and "I'm no noob."
Yes, sir, you are, in the extreme. |
Oh, look, more flaming. Is it helping anything? For the third time, we're talking about cases where the program will fail in a situation that is never going to occurr.
Quote: |
I don't mean it to be disrespectful |
Sure fooled me.
Quote: |
That said, look, you need to face the truth: you do dangerously incorrect things, and you fail to understand basic principles of the language. |
Feel free to point these out then. I'm not going to learn from my mistakes if I don't know what they are. Go on, point out some of the problems in my code.
Quote: |
I'm trying to get you past a personal inhibition and to move you towards progress. |
What do you define "progress" as, then? Does the fact that my program works just fine not count?
Quote: |
You have shocking misconceptions about the language. You're doing things that are provably incorrect. There's undefined behavior all over your code. You would not pass a CS 110 class. |
And yet the compiler doesn't complain (save for the signed/unsigned comparison), the program works, and nobody has yet pointed out these huge mistakes. Hm.
Quote: |
You need to accept that you're a novice, and to start working on fixing that, instead of to continue to charge blindly ahead. |
I wouldn't have thought a novice could write a Mario Kart 64 level editor. Any time I see myself doing something wrong like that, I fix it. So, tell me, what am I doing wrong?
Quote: |
People who insist on doing it the way they taught themselves, instead of learning to do it right, turn into Tepples.
Do you really want to be a Tepples-style engineer? |
Quote: |
I'm trying to prevent the formation of a new Tepples. The forum is burdened enough with stupid already, and that kind of clash of titans could tear the universe to shreds. |
We're going to need another fire extinguisher.
_________________
I'm a PSP hacker now, but I still <3 DS.
#133662 - tepples - Sat Jul 07, 2007 11:41 pm
HyperHacker wrote: |
As I stated, adding casts all over the place to prevent a problem that's never going to occurr is just going to make the code ugly and hard to read. If x is a 32-bit unsigned integer that is never going to come close to 0x7FFFFFFF, who cares if I'm doing for(i=0; i<x; i++) with i being signed? |
Then why is x defined as unsigned, or why is i defined as signed? As far as I can tell, the warnings are there to make you think about these nitpicks. I normally compile with -Wall -O2; adding -Wextra sometimes helps me find defects in my code that I didn't know about before.
Quote: |
Quote: | IFAIK a "Hard" real-time OS is an Operting System in which the worst-case execution time of the system calls is either known beforehand or computable based on the how the application is configured (aka no. of threads, no. of interrupting sources, their periodicity) etc.. but I have not been successful. |
System calls? Last I checked, those are in the BIOS. The firmware is removed from memory, save for user settings, once the DS card is booted. Is this not correct? |
PictoChat and DS Download Play have rawther strict timing requirements, or the communication will fail.
Quote: |
For the third time, we're talking about cases where the program will fail in a situation that is never going to occurr. |
How do you know that it isn't going to occur as of future changes to the requirements?
Quote: |
Quote: | That said, look, you need to face the truth: you do dangerously incorrect things, and you fail to understand basic principles of the language. |
Feel free to point these out then. |
As far as I can tell, StoneCypher wants you to buy the book and read it when you get the chance, learn things about C++ that you never knew before, and then come back to your code with the new knowledge. But I question SC's lack of chapter numbers; every time Eli Zaretskii of the newsgroup comp.os.msdos.djgpp referred someone to the group's FAQ, he cited which chapter contained the answer to the question.
Quote: |
Quote: | I'm trying to get you past a personal inhibition and to move you towards progress. |
What do you define "progress" as, then? Does the fact that my program works just fine not count? |
How can I know whether my program actually works, or whether it just works on my DS with my firmware settings using my brand of memory card and my brand of adapter? Donald Knuth always taught that testing is not enough.
Quote: |
And yet the compiler doesn't complain (save for the signed/unsigned comparison), the program works, and nobody has yet pointed out these huge mistakes. |
The compiler cannot detect all defects. GCC can't even detect some programs that rely on undefined behaviors.
Quote: |
I wouldn't have thought a novice could write a Mario Kart 64 level editor. |
It doesn't take as much experience to write a level editor as it does to write a game engine and a level editor and make all the meshes and textures.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#133666 - StoneCypher - Sat Jul 07, 2007 11:55 pm
Simon Hall: if you take a look around, you'll slowly realize that all the old hands at this board are sick to death of Tepples. There's a good reason for that. Why the attitude? Because he condescends to people. This conversation started when he stepped into me talking to a third party and told me I was wrong about something I wasn't wrong about.
He gets this because he earns it. He's a clueless hack who pushes bad code on a regular basis and pretends to be a hell of a lot better than he actually is.
As far as whether I'd want this kind of treatment, you're dead wrong. I went to IRC channels specifically to get people to tell me what was wrong with my code, and that's just how you get treated on IRC. So please, don't speak for me until you know me.
Tepples wouldn't get shat on if he didn't start conversations by shitting on other people. If you're not willing to read back and find out what happened, you really shouldn't speak up in criticism, as you end up fuelling the aggressor morons.
_________________
Quidquid Latine dictum sit, altum Sonatur
[Images not permitted - Click here to view it]
#133668 - StoneCypher - Sat Jul 07, 2007 11:56 pm
Quote: |
K, now you're just being a dick. |
You're welcome for all the help. You'll never get it again. Welcome to the sidelines.
_________________
Quidquid Latine dictum sit, altum Sonatur
[Images not permitted - Click here to view it]
#133673 - simonjhall - Sun Jul 08, 2007 12:08 am
@SC: Yeah, I'm gonna avoid passing judgment here. However, if there are people who are just new to the boards and see threads about simple control characters turn into pretty negative threads, what should they think?
I'm obviously missing the whole behind-the-scenes thing, as I don't do IRC (hence I'm not gonna criticise) - I'm just interested in why whenever I see posts by you they're always negative - that's all. Obviously you have some beef with tepples that I've not seen...how about you both keep it there?
Quote: |
I went to IRC channels specifically to get people to tell me what was wrong with my code, and that's just how you get treated on IRC. |
Maybe I'm not missing out by not using IRC after all.
Where the fuck are the mods on this board? Ou est the 'delete thread' button?
_________________
Big thanks to everyone who donated for Quake2
#133677 - agentq - Sun Jul 08, 2007 12:18 am
I agree with Simon, there's no need for this kind of thing here. It'll just mean that people with problems won't want to post because they'll be treated badly.
Quote: |
I went to IRC channels specifically to get people to tell me what was wrong with my code, and that's just how you get treated on IRC. |
Why? Surely you should treat people with some kind of respect, even on IRC?
#133680 - StoneCypher - Sun Jul 08, 2007 12:21 am
Quote: |
I'm obviously missing the whole behind-the-scenes thing, as I don't do IRC (hence I'm not gonna criticise) - I'm just interested in why whenever I see posts by you they're always negative - that's all. Obviously you have some beef with tepples that I've not seen...how about you both keep it there? |
No. If tepples gives people bad advice with undefined behavior, I'm going to warn them, even if you don't like it. You have an interesting idea of not passing judgement, when following through with lines like "I'm just interested in why whenever I see posts by you they're always negative."
It's because people who frequent both places come back to IRC complaining about the new mess Tepples is creating, and I go there to set the record straight for whoever's about to get the raw end of the stick.
Simon, I was active on this board before you even heard of it. My old account got deleted for *age* before you ever even heard of me. I don't really care what you think of how I speak. I'm here because I have friends here who are being given extremely bad advice.
And if you don't like that I'm helping them, well, then just stop reading what I have to say. I have no beef with you and we have friends in common, but you're a bit condescending for my tastes.
Why does Tepples piss me off? Don't worry - when you've been around for some significant amount of time, you'll start to get it too. If you really can't put together why it's all the people who've been around since more than the last 20 minutes who are saying bad things about Tepples, well, that's really not my problem.
Last time, I tried to hint at it politely. This time I won't. Simon, let it drop.
_________________
Quidquid Latine dictum sit, altum Sonatur
[Images not permitted - Click here to view it]
#133682 - tepples - Sun Jul 08, 2007 12:21 am
simonjhall wrote: |
Where the fuck are the mods on this board? Ou est the 'delete thread' button? |
I would have split this a long time ago, and I did split it once, but at this point, deleting the topic would destroy what might be evidence in an open request for comment.
StoneCypher: As far as I can tell, following a policy similar to this Wikipedia policy would make it harder for anyone to attack you in return. Please tell me what's wrong with my code, not with me.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#133683 - StoneCypher - Sun Jul 08, 2007 12:22 am
AgentQ: Respect is earned. When you've known someone for as long as I've known Tepples, you come to know a lot about them.
Yes, I treat lots of people with respect. He isn't one of them. I don't expect you to understand it, but I do expect you to see the pattern. It isn't just me, and I get a little tired of the mob pretending that it is.
_________________
Quidquid Latine dictum sit, altum Sonatur
[Images not permitted - Click here to view it]
#133684 - StoneCypher - Sun Jul 08, 2007 12:24 am
Quote: |
Please tell me what's wrong with my code |
Every time you ask me this, I tell you no. I already gave you an extensive list of flaws in various posts. You're just asking this to look like the aggrieved party; you spend so little time reading what's said to you that you neither realize that you've already received this nor that I've told you "no, no more."
Your attitude is too abrasive. I will not help you further than I already have. If you want to see the flaws, go read what I already said. There are seventeen flaws listed, and you didn't even notice.
What amazes me is that anyone is ever fooled by your on-the-cross act.
_________________
Quidquid Latine dictum sit, altum Sonatur
[Images not permitted - Click here to view it]
#133692 - tepples - Sun Jul 08, 2007 12:38 am
StoneCypher wrote: |
Quote: | Please tell me what's wrong with my code |
Every time you ask me this, I tell you no. I already gave you an extensive list of flaws in various posts. |
Various recent posts, or various posts over the years? Should I just read your posting history?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#133698 - HyperHacker - Sun Jul 08, 2007 1:00 am
tepples wrote: |
HyperHacker wrote: | As I stated, adding casts all over the place to prevent a problem that's never going to occurr is just going to make the code ugly and hard to read. If x is a 32-bit unsigned integer that is never going to come close to 0x7FFFFFFF, who cares if I'm doing for(i=0; i<x; i++) with i being signed? |
Then why is x defined as unsigned, or why is i defined as signed? As far as I can tell, the warnings are there to make you think about these nitpicks. I normally compile with -Wall -O2; adding -Wextra sometimes helps me find defects in my code that I didn't know about before. |
This is basically the same code I posted above, with NumFiles changed to x. It doesn't make sense for the number of files to be negative, so it's unsigned. i is used in a few other places in the routine where it can be negative. Having NumFiles unsigned also simplifies sanity checking: I can just do if(NumFiles > SomeHugeNumber) as opposed to if((NumFiles > SomeHugeNumber) || (NumFiles < 0)).
Quote: |
Quote: | For the third time, we're talking about cases where the program will fail in a situation that is never going to occurr. |
How do you know that it isn't going to occur as of future changes to the requirements? |
Over 2,147,483,647 files in one directory on a DS? I think not.
Quote: |
Quote: | Quote: | I'm trying to get you past a personal inhibition and to move you towards progress. |
What do you define "progress" as, then? Does the fact that my program works just fine not count? |
How can I know whether my program actually works, or whether it just works on my DS with my firmware settings using my brand of memory card and my brand of adapter? Donald Knuth always taught that testing is not enough. |
Well no, I don't know that it works in every scenario, that's what beta testing is for. But it works fine for me, and I don't see any huge screwups in the code, so chances are good it will work for others.
Quote: |
Quote: | I wouldn't have thought a novice could write a Mario Kart 64 level editor. |
It doesn't take as much experience to write a level editor as it does to write a game engine and a level editor and make all the meshes and textures. |
But then you're getting into game design, graphics, etc. Also this point is kind of moot. So there are more difficult things than making a level editor... how does that change anything?
StoneCypher wrote: |
Quote: | K, now you're just being a dick. |
You're welcome for all the help. |
Sorry, it must have got lost in the mail. I'll tell you when it arrives.
agentq wrote: |
Quote: | I went to IRC channels specifically to get people to tell me what was wrong with my code, and that's just how you get treated on IRC. |
Why? Surely you should treat people with some kind of respect, even on IRC? |
You should, but in my experience, people in #dsdev tend not to. That's not to say that all IRC channels are the same, though, or that nobody in #dsdev will treat you with respect.
StoneCypher wrote: |
AgentQ: Respect is earned. When you've known someone for as long as I've known Tepples, you come to know a lot about them.
Yes, I treat lots of people with respect. He isn't one of them. I don't expect you to understand it, but I do expect you to see the pattern. It isn't just me, and I get a little tired of the mob pretending that it is. |
I don't think you've shown any respect toward anyone in this thread.
Tepples at least tries to help. He probably should be checking his facts more thoroughly before posting them, but he's making an effort. You just seem to go around saying things like "your code is completely wrong, you're a total n00b, learn C, you don't know what x is", etc. This is just flaming, and serves no useful purpose.
_________________
I'm a PSP hacker now, but I still <3 DS.
#133719 - NEiM0D - Sun Jul 08, 2007 2:16 am
Hurray, personal attacks are always so fun fun fun.
#133723 - tepples - Sun Jul 08, 2007 2:39 am
There are some topics that I can't just split because single posts refer to both the on-topic part and the off-topic part. In those cases, I just try to swing the discussion back on topic, like this:
HyperHacker wrote: |
tepples wrote: | HyperHacker wrote: | If x is a 32-bit unsigned integer that is never going to come close to 0x7FFFFFFF, who cares if I'm doing for(i=0; i<x; i++) with i being signed? |
Then why is x defined as unsigned, or why is i defined as signed? As far as I can tell, the warnings are there to make you think about these nitpicks. |
i is used in a few other places in the routine where it can be negative. |
In that case, it might be a better idea to use the new syntax for loop counters, which C added in 1999[1] and C++ before that:
Code: |
for (unsigned int i = 0; i < nFiles; ++i) {
// do stuff
} |
This way, the variable i is scoped to the for loop and nowhere else.
Quote: |
Quote: | How can I know whether my program actually works, or whether it just works on my DS with my firmware settings using my brand of memory card and my brand of adapter? |
Well no, I don't know that it works in every scenario, that's what beta testing is for. But it works fine for me |
So what do you do when you cannot reproduce a problem that your beta testers encounter? This has happened to me a few times in the development of one of my own games.
Quote: |
Tepples at least tries to help. He probably should be checking his facts more thoroughly before posting them |
That's probably the most accurate assessment that I've read today. I'm hoping some people might back off if I try Wikipedia-style citations for more of my claims.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#133731 - DragonMinded - Sun Jul 08, 2007 5:46 am
HyperHacker wrote: |
tepples wrote: | HyperHacker wrote: | As I stated, adding casts all over the place to prevent a problem that's never going to occurr is just going to make the code ugly and hard to read. If x is a 32-bit unsigned integer that is never going to come close to 0x7FFFFFFF, who cares if I'm doing for(i=0; i<x; i++) with i being signed? |
Then why is x defined as unsigned, or why is i defined as signed? As far as I can tell, the warnings are there to make you think about these nitpicks. I normally compile with -Wall -O2; adding -Wextra sometimes helps me find defects in my code that I didn't know about before. | This is basically the same code I posted above, with NumFiles changed to x. It doesn't make sense for the number of files to be negative, so it's unsigned. i is used in a few other places in the routine where it can be negative. |
Good coding practices dictate that you shouldn't be using a temporary variable in multiple places in your code. That i should be scoped, as tepples said, for the loop only. If it really is just a menial loop, i is fine, but if i is actually an index into a list of files, you might consider naming it to something more useful like fileIndex. Having a temporary variable pop up all over a function is a good sign you aren't 100% sure what you want. I know from personal experience too that modifying code like this can be extremely difficult. Don't be afraid to give descriptive names to your variables and type them appropriately.
As an aside, check out "Code Complete" as it is an extremely good guide to creating proper software that I wish I had known about before starting my projects. It will explain to you exactly why you don't want this i floating around and why you shouldn't get that error.
_________________
Enter the mind of the dragon.
http://dragonminded.blogspot.com
Seriously guys, how hard is it to simply TRY something yourself?
#133822 - HyperHacker - Sun Jul 08, 2007 11:48 pm
I use that when I do C++, but I found the version of GCC I was using to write Windows programs in C didn't like it. Maybe I need to set some flag or something for that. If the DKP version supports it, then I'll go change that, because I agree it is a much better method.
tepples wrote: |
So what do you do when you cannot reproduce a problem that your beta testers encounter? This has happened to me a few times in the development of one of my own games. |
Well that's when you have to start working together with them, having them try modified versions and seeing how their setup differs from yours and so on. It's not an easy situation to deal with by any means, but these problems are going to come up no matter what your coding style.
Also I should probably take this opportunity to take back a few things I said earlier. I realize StoneCypher did at least try to offer some help, albeit not very well. As for #dsdev, I guess my memory is failing me. I'm looking back through the logs and finding there was really only one person being a jerk. (Interesting coincidence, he went by the name StoneCypher!)
_________________
I'm a PSP hacker now, but I still <3 DS.
#133825 - tepples - Mon Jul 09, 2007 12:14 am
HyperHacker wrote: |
I use that when I do C++, but I found the version of GCC I was using to write Windows programs in C didn't like it. |
For various reasons that I don't completely understand, the latest version of the MinGW toolchain still uses GCC 3.4. C99 behavior was not the default in GCC 3.4. To turn on C99 behavior in this version, use gcc -std=gnu99.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#133836 - HyperHacker - Mon Jul 09, 2007 3:18 am
Actually, looks like DKP's version needs it too. Or am I out of date again? Thanks BTW.
_________________
I'm a PSP hacker now, but I still <3 DS.