|
Levels-4-You : Lounge : Irrlicht Engine roxorz! |
[Forum Rules] |
Vidi44 |
Posted 20th Jan 2006 10:02pm |
L4Y Member Post 537 / 668
 |
Yes, I did notice that the garbage collection in .NET makes each file giant (I think I called it "adding on the SDK", even though its actually just adding on the memory management module and a file containing places where it should remove the memory and how to do it).
Further, I do appreciate the micro-course on using non-custom libraries. Of course, as I use an IDE, I could probably just go to the settings and add it in. <checks, yes it is possible, for both Sally and Dev>. Now, a quick and rather n00bish question, what's the difference between gcc and cpp?
Yes, MS did intend on .NET being multiplatform, but dropped it. They say that they are thinking about trying it again, but most likely they'll realize it would go against Bill Gates' philosophy that if you aren't running Windows, you don't count.
I'm sure C++0x will have pointers, as it would need to have backwards-compatability. Interestingly enough, pointers are on the list of "no-nos" that this one programming teacher printed for me (a lot of them made sense, such as GOTOs and statically dimensioning an array at the beginning of the program that will last until the end. However, some made no sense, such as "don't use arrays" and "everything must be in its own module" (in case you didn't figure it out, it was my BASIC teacher that printed this list out, although almost the entire list applies to all languages). I just wish that I could find the list, as it was rather intriguing the many things you apparantly aren't supposed to use (if it was a C++ class, non-standard libraries probably would have been on there, lol).
As far as your friend is concerned, it makes no difference to me what your views are. The only reason I went into as much detail about equality and that is because a human form I know spent about half an hour straight talking about perceived inequality, and it was just left in my brain. So, I apologize for my little rant back there and hope you weren't bothered by it. |
"Don't go there. It's ugly, and it never stops being ugly."
"Naps are good" - Visual C++.NET for Dummies, page 1 |
|
|
cyrus5 |
Posted 22nd Jan 2006 4:26pm |
[CP] Director L4Y Member Post 50 / 241
 |
In C++ btw, if you are writing a program that doesnt use alot of windows libraries, adding
define WIN32_LEAN_AND_MEAN
or
define VC_EXTRA_LEAN
causes alot of infrequently used libraries to be left out, making the exec smaller and quicker.
gcc is a multiplatform, very standard compliant c++ compiler, its available for almost every platform concievable, comes as standard with every *nix os as well as other build tools like make. cl is the microsoft c++ compiler/linker and is available for windows only. Not much between them honestly, the filesizes are smaller with gcc, cl might be more optimised. The intel compiler is supposed to be good as well but I havent used it.
Goto's are messy imho. the only *nice* use for them was replaced by exception handling. I.e. if you have alot of things in one function that could fail, but you need to ensure that the function exits leaving the application in a valid state by using a common clean up code, then goto was one of the ways to implement it. for example
function Pointless()
{
char* myarray = malloc(4096); //4k
if (myarray == 0)
goto cleanup:
if (!DoSomethingToArray)
goto cleanup:
myarray = realloc(myarray, 8192);
if ( myarray == 0 )
goto cleanup:
cleanup:
if ( myarray ) free(myarray);
// do some funky lengthly clean up tasks
}
I've never used them, but I believe thats the only 'near accepted' use. Pointers on the other hand should be encouraged, they are incredibly efficient when used for sorting algorithms, searching, manipulation of large amounts of data. All they are is an integer that contains the address of some piece of data. the data of which can be accessed by using *[variablename]. Operations on *[variablename] affect the data pointed to and operations on just [variablename] alter the address. so doing
int a = 256;
int* b = &a; // b is a pointer to an int. b contains the address of a
*b = *b * 2; // a is now 512
b += 1; // the address stored in b has been incremented, it now points to what ever happens to be after a, using b like this is not good since we havent allocated anything after a
// on the other hand its useful when doing
int c[2] = { 23, 192 };
b = &c[0]; // of b = c; equivalent since c is a pointer to the first of 2 integers.
b++; // b now points to the integer '192' rather than '23'
There are alot of things some people see as no-no's where as others cant survive without them, it more or less comes down to some trade off of complexity vs perfomance vs elegence vs stuborness. In OO there are alot of anal retentive ideoms such as the Law of Demeter, its a good recommendation for the design of your app, but to completely comply means alot of refactoring and typically the introduction of numerous adapter classes for shoe horning things into functions that are not supposed to know about what they do. Its a level of further uncoupling classes, and is 'good OOD' but is difficult to implement successfully. Not using arrays sounds like the mutterings of a mad man however! Very little you can do without them. unless he meant you should encapsulate arrays into useful classes like vectors lists stacks queues deques and the such.
The idea of non standard libraries in integral to the OO methodology that nice modular code should increase reusability to stop you having to write string tables, linked lists, class factories, maths functions and all those common things that you would end up writing over and over again. |
Only the dead have seen the end of war - Plato
I think it would be a good idea. - Mahatma Gandhi, when asked what he thought of Western civilisation.
cyrus5.co.uk! |
|
|
Vidi44 |
Posted 22nd Jan 2006 10:39pm |
L4Y Member Post 544 / 668
 |
The (sort of sad) thing is that last night I got fairly bored and decided to look around on what gcc and g++ are. As you said, they are the GNU specification of C++, which is multiplatform.
As I use two IDEs (well, I have two, I use one), Sally -A Simple C++ IDE (very good, includes an icon creator and some nice stuff. Good for special tasks. I have it using the Borland 5.5 compiler, which isn't half bad) and Dev-C++ (4.9.9) (uses gcc, which you'd think I'd have paid attention to earlier. Before I got to thinking on the differences, I thought it used MingW32 (which it does, just that Ming is a gcc varient)). Dev is good for general programming and is a very good IDE compared to even VS (although VS does have its superior moments, there aren't many, lol).
What do you mean by "cl"? I'll just guess you mean "common language" (as in VS.NETs Common Language Runtime (CLR). By that token, cl would indeed be optimized for Windows. However, gcc (well, at least Dev-C++) does have a series of optimizations for Intel chips (as well as AMD), which equates to the most minute of differences between cl and gcc.
Gotos are dead, as even your own example proved mostly pointless. Why goto the block of code when a function would work? Most of the time, gotos can be eliminated with either a loop, function, procedure (subroutine), or re-coding to avoid the unnecessary usage of them. Of course, gotos did fulfill a purpose, its just that with modularization and OOP developing during the 60s and 80s (respectively), they became unnecessary.
As far as killing off the array, I said the same thing, and all my teacher could say was that "they cause buffer overflows". Being the n00b I was at the time, I didn't know that you could very easily redimension them. Of course, that's usually where the overflows start . Thus, the solution to continue using arrays "legally" is to intelligently think about how much memory your program will use. Instead of redimensioning it each time something is added (although it is efficient on low-memory computers, its fairly useless to do that nowadays), redimension only once or twice through the program.
The secondary source of buffer overflows is in addressing an out-of-range array (ie you dimensioned to 100 places, so you call spot 100. You do have 100 places, its just that 0 through 99 are your spaces (ie 100 doesn't exist yet)). This is easily fixed by paying attention to your code and thinking before you set the limits you are. This, combined with not constantly redimensioning your arrays (in which case it'd be human to refer to spot 99, despite having redimensioned the array down to 95 earlier), should almost eliminate these buffer overflows.
Also, I use arrays in practically every program I write. I'm just making my teacher proud, aren't I? It always was a real Canadian thing to try to write code in that class without using arrays (I'd have to use pseudo-arrays. ie creating a new variable based off a decision block. ex (using BASIC notation, as it is what I used in that class. This means the ideas of vectors were ignored):
For intX = 1 to 10
If intA <>0 Then
intB = ValueSomethingOrOther
Else
intA = ValueSomethingOrOther
End If
If intB <>0 AND intA <>0 Then
intC = ValSomethingElse
ElseIf intB = 0 AND intA <>0 Then
intB = ValSomethingElse
End If
'//Continue on until you reach the end of the loop.
Obviously, this would only work if you have a very small loop (which we did). If you had a real-world loop, you'd be Censored after about 10 variables defined (get so bored and tired you'd mess up). Also, to use any of the variables, you'd have to go through the code by hand and pick (or guess) which value you'd need (because the decision block will quickly confuse you, so you couldn't just find it quickly). If you needed to use a wide range of the values, you'd have to create another loop and a decision block.
As you can see, we do prevent buffer overflows, but we do this at the cost of an almost 10x increase in errors (when we got to pseudo-arrays, there wouldn't be more than 2 seconds into testing before someone got an error). So, we do accomplish the instructor's demented goal, at the sacrifice at many more errors.
The idea behind OOP is indeed spiffy, however so far I haven't a single time when I've reused my code (headers don't count, as they aren't mine). Aside from my 10 line "Header" that I wrote for QB (inputs your name, then displays it in a title that is centered along with the program's name). This, of course, I could easily re-write at any time with no problems. Something like a card game is spiffy for OOP (imagine re-writing the massive block of code that is used to just create the deck of cards, not to mention deal them, etc). However I don't see myself using ideas of OOP in the real world (of course, I probably will find myself in such a position someday). How often have you actually re-used your (own) code?
I won't get into pointers because although I know the basic idea, I still think it'd be best to wait until I get the rest down. Basically, pointers are what VB calls "reference variables". They copy the value of a variable into another variable. That way, if you need to calculate something, but need the original value later, you can do it. Of course, IMHO creating a separate variable would work just as well for this case.
As far as the Law of Demeter (LoD) (idea in OOP that you should only expose your code to functions/classes/etc that they need to see. ie you wouldn't let your multiplication function have access to an addition function. Instead, you'd have an intermediary module/class/function that would "talk" between the two) is concerned, I don't regularly use it (I'm a n00b!). Generally, if I plan something to "talk" to something, it should have unrestricted access (I'm not a dictator ). This still works for me because I'll actually take the time to make sure all my functions and variables have different names in all classes, modules, etc. However, when I start working on a team, I might want to start thinking more of the LoD.
Being the BASIC n00b I am, with very little experience with C++ (I finished Quiz 1 on cppworld.com, if that's any gauge at my skill); I'd like to apologize for my more "deferred" times. However, it is only by questioning everything do we learn more and more every day. |
"Don't go there. It's ugly, and it never stops being ugly."
"Naps are good" - Visual C++.NET for Dummies, page 1 |
|
|
cyrus5 |
Posted 24th Jan 2006 3:07pm |
[CP] Director L4Y Member Post 52 / 241
 |
Yeah I use devc++ from time to time, some thing its less painful to do with it, it tends to be the ide I use when I want to knock up a program quickly to test something. Mostly this is using Opengl.
cl.exe is what I meant, its the compiler that visual c++ uses. most of the time you dont know the name, its never mentioned int he ide, the only time you use it like that is if you are compiling off the command line instead.
C++ has references as well.
void AddThree( float &var )
{
var += 3;
}
that passes by reference so the original is changed.
Arrays can cause overflows, which is why the standard template library is useful. they have encapsulated forms of arrays that handle allt he reallocation for you, as well as index checking and such like. they are well programmed and pretty quick, so in all honesty its often not worth programming them yourself.
I reuse a fair bit of my code. I have created a few project files for devc++ and visual c for common programs, basic framework programs for opengl, basic 2d ortho projection, basic 3d projection with a polar camera system. Very useful starting points. I have a maths library that i reuse, have developed that over the years, vector, matrix, quaternions, interpolation, bezier curve functions. I have another that when you include it overrides the new and delete operators and logs allocations, indispensible for tracking memory leaks. Have some texture loading and model loading libraries, part my own work. Have a lib i wrote for creating texture fonts out of true type. Also have a large number of programs I have written that I copy and paste code from.
Nothing wrong with oop. But alot of it is common sense, if im making a game with sky terrain, tanks, guns and pink elephants then I shall have a Terrain Class, a Sky class, a tank class, a gun class and a pink elephant class. its worth reading design pattern stuff, but once you have been coding for a while, you get a solid feel for what works, whats a pain in the CENSORED and whats worth stealing, oops I mean, 'reusing'! |
Only the dead have seen the end of war - Plato
I think it would be a good idea. - Mahatma Gandhi, when asked what he thought of Western civilisation.
cyrus5.co.uk! |
|
|
Vidi44 |
Posted 24th Jan 2006 10:32pm |
L4Y Member Post 548 / 668
 |
Well, first I'll get the joke out of the way. I was going to use this joke in general discussion (in the real world, dir!), but the topic hasn't come up yet Here it is, basically (not complete as I'm constantly refining what I consider to be my own personal best in programming humor (my second best is when I was talking to a female form I know and was telling her that I had to go knock up Sally tonight (knock up - input a program and compile it for distribution. Sally - one of my many C++ IDEs). actually, I take that back, my second best is still one of my best ) (warning, this joke is full of double entondres, not for those afraid to think) :
<teacher's name, removed for privacy>, Sally left me! I was at home last night, and I got this message. It said that Sally couldn't take it anymore and left <reference to overloading the compiler with errors). I searched all night for her, but I couldn't find her <reference to updating "Sally -A Simple C++ IDE", as my code was correct and I thought it was an error with the IDE (its in perpetual beta afterall)>. So, I go online and here's Missy sitting right there <Missy, sort of slang for MicroSoft Integrated Environments, my word for Visual Studio (because VS is a weak name, it completely abandons the programmer's desire to name all things after an unknown female (aren't all your favorite programmers named after or dedicated to some programmer's wife or girlfriend? Mine are))>. I felt like such a fool. <reference to the fact that the class I'd present this joke in has an actual person nicknamed Missy, and we continually joke of things of dubious nature (fear not, the Code prevents all actions (Code - Earl's Code, a moral code developed by Dr. Earl Euradere. Its cornerstone moral is that one should take a human friend and not a girlfriend (sure, I did explain human friend is PC for girlfriend, but it has the extension of an almost entirely emotional basis (ie friends not Censored ))>.
This part here is where I'll condense stuff. Basically I get sidetracked and duel people in coding competitions. Stuff like "first to finish "Hello World" in 3 languages, most compact code, most commented code, etc. I lose the "Hello World" challenge because I couldn't properly spell that night (printg() is not a function!). I lost the most compact code because I used too much whitespace (I'm used to double spacing after every line and spacing thrice when indenting). I did win the most commented code, when I threw out my "RetardMath" program (basically, it gives you a fake answer the first time, but stores the actual result. Then, on the next question it'll output the real result from the previous question and store the real answer to the current question. etc.) It had only 50 lines of code, but some 120 lines of comments (I explained in great detail how the varying functions work, what each statement does. I even included programming history and some jokes on it. Sure, they were useless, but with the fourth fastest time and that many comments, it was worth it). Then, I return to programming
So, I program in Missy for a while, and find that its pretty spiffy. Unfortunately, I'm not liking Missy's attitude when I shove in some random data. Its like she doesn't like it or something. So, I throw her to the curb <obvious reference to uninstalling program>and pick up Sally again. Sure, she might not be fully featured <reference to Sally lacking a centralized debugger>, but at least she won't complain when I pull out In hindsight, its best you don't know the acronym for that program, so use your imagination .
[/story]
Well, with that (pretty perverse) story finished (it would have been funnier in real life, because I informed a few people in that class that I'd do this, and they'd help me along if the joke seemed to lag. Regarding the actual person named Missy, she said it was fine, and even wrote the ending to it (I originally was going to say that Sally was better because she wouldn't grab me by my constructs and decompile my headers <reference similar to how the ending went, but gives images of eunuchoidism, which isn't a plesant thought before lunch (when that class was)>) and came up with the pseudoname for VS (wonder why she chose that name?).
Regarding the rest of your post, I use Dev-C++ more and more every day it seems. Sally is nice for icon generation, and as she has the look and feel of Missy (VS for those of you who skipped the story), she isn't half bad (I use the term "she" because like a ship, programs and that are typically referred to as female (some old naval tradition about having the love of your life eternally by your side as you sail the seas)). However, Sally lacks a debugger and a lot of features that I'd like to see are missing (and with no plug-in support or source code, I can't even attempt to add them myself).
Well, I never like to use anything unless I know at least something about it. So, each time I get a new IDE or compiler, I'll check what it uses (that way if it uses one I already have, I won't need to download it). The easiest way to figure it out is by checking the folders you have the IDE in. Check something that says something like "lib" or "library" (dir, that's only common sense). Dev-C++ is nice in that it has about 5 folders named "Ming32" and "gcc" throughout its library directories.
Being the n00b I am, I generally don't use templates (aside from the fact that I don't know how to use them because Dev just incorporates them into the "new project" wizard. Further, templates are considered "advanced", while I'm at "beginner/n00b". I apologize for not getting directly into C++, however all my books cover only until you hit classes (which makes me wonder why 5 books don't include something you consider so useful).
As I said, I haven't yet found a use for full-featured OOP (PC:CE uses classes, yes. However the class use is so sparingly that I might as well use functions).
Some time in the future (when I've more knowledge of using custom libraries), I'd enjoy seeing your custom libraries. Until then, I'll have fun reinventing the wheel (why does everyone have an objection to it? I was once told to abandon a project because they knew of a series of libraries that'd do the same thing for me. Well, aside from wanting everything to be a learning experience, the project needed to be my own work. Further, "reinventing the wheel" is useful to learn new things and rehash old ideas to keep them fresh (some day, we may come upon programmers who know nothing more than how to string libraries together. No code will be written, just library after library called. From there, its simple argument passing in the main function and you'd have a "program")). |
"Don't go there. It's ugly, and it never stops being ugly."
"Naps are good" - Visual C++.NET for Dummies, page 1 |
|
|
SKA-Diesel |
Posted 25th Jan 2006 12:16am |
L4Y Member Post 449 / 719
 |
^^Worst joke ever, but Im sure if Billy Connolly was telling it I would still laugh. |
|
Vidi44 |
Posted 26th Jan 2006 2:04am |
L4Y Member Post 554 / 668
 |
I never said it was the best joke ever. It was merely one of my best programming jokes. Also, I suppose you'd get twice the kick out of it if you used Sally (she's free, and only 1.5 MB. sallyide.sourceforge.net I think) and knew the people who helped design the joke.
Also, try thinking of the double entondres (or however you spell it) spread throughout the joke. It might also help knowing that I have no actual human friend (remember, PC term for girlfriend), at least not anymore. Since then, I've done little in the way of socilizing and developed an odd sense of humour. In other words, the joke would start out getting people's hopes up (yes, there has actually been a series of bets among the ladies about who'd take me out, and I've actually had a misguided friend try to set me up with someone online. People who know me are actually that interested in me re-finding my social life (perhaps because I made everyone laugh and all that stuff. However, you can't use humor to feed your kids or pay your way through college (unless you're a very good comedian))).
Of course, one can never force a joke, but I would appreciate it if you'd re-read the joke with the above in mind.
Never heard of Billy Connolly either, however I do have his site loading right now and it should be done in about 5 minutes (I'll wait until its loaded before further commenting).
<roughly 25 minutes later (long time to open the site)>
<while waiting, I drank 2 glasses of water, downloaded 200 messages from my inbox (might not have wanted to do that, slowed down the connection), got screamed at by my mommy for being on the computer doing nothing, read a chapter in my C++ book, and went to the bathroom. I feel better now, and like Fred Fredburger says, "the nachos made my poo-poo really stinky">
I couldn't find anything on his comedy from his site. Do you have anywhere where I could listen to some of it? |
"Don't go there. It's ugly, and it never stops being ugly."
"Naps are good" - Visual C++.NET for Dummies, page 1 |
|
|
Beatonator  |
Posted 26th Jan 2006 5:33pm |
Post 1143 / 3716
 |
Billy Connoly rules! 
"How do you know your upside down?"
"The S**t's coming out my collar"
I like his WW2 veteran joke too |
Trying to find old players. Anyone about? Drop me a PM or reply to this thread:
>Link< (or head over to RFrun.net's comment section!) |
|
|
Kiliad |
Posted 26th Jan 2006 10:58pm |
L4Y Member Post 115 / 672
 |
Hmmm... the thread must have wandered off topic a bit somewhere.
I'm too lazy to go and read everything so can I have a quick summary.
Has anyone made anything with the Irrlicht engine? I looked at it about a year ago and thought it had a lot of potential. |
"The pen is mightier than the sword.. and considerably easier to write with." - Groucho Marx |
|
|
Vidi44 |
Posted 27th Jan 2006 1:42am |
L4Y Member Post 556 / 668
 |
To tell you quickly:
No, no one has written anything with Irrlicht, as of yet. We are currently studying up on our C++ skills so that when we create something, it'll be with skill, not luck.
The off-topic-ness was actually recent, and we often get back on track as soon as someone has another development or question related to either programming or Irrlicht.
I've never heard of Billy Connolly because:
1 My mommy won't let me buy that stuff (even Jeff Foxworthy is pretty much banned) :'(
2 He's not on Comedy Central (haven't seen him on it, at least)
3 I should've seen him on Conan, but lately I've been falling asleep around midnight, not 1:30 (which is good for my health, but bad for my comedical skills, as Conan is arguably one of the best late-nighters there is)
4 You never sent a link to listen to his stuff online (a lot of places will stream an artists music, which is legal).
Yes, I am a n00b. |
"Don't go there. It's ugly, and it never stops being ugly."
"Naps are good" - Visual C++.NET for Dummies, page 1 |
|
|
goober |
Posted 27th Jan 2006 1:44am |  |
L4Y Member Post 1899 / 265
 |
Quoting Vidi44 | To tell you quickly: |
good choice. do it more often |
For anyone reading this in 2019 or later: The RF community is alive on the Community Discord
[Faction Files] |
|
|
Vidi44 |
Posted 27th Jan 2006 2:03am |
L4Y Member Post 557 / 668
 |
Quoting goober | Quoting Vidi44 | To tell you quickly: |
good choice. do it more often |
Rofl, just because of that, I won't |
"Don't go there. It's ugly, and it never stops being ugly."
"Naps are good" - Visual C++.NET for Dummies, page 1 |
|
|
Page 4 Multiple Page Topic : 1 2 3 4 |
    |
|
|
|