Results 1 to 15 of 307

Thread: Coder's Hang-out

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Quote Originally Posted by kohlrak
    So, basically, as long as i don't have a function call itself, i don't have to worry about anything, right?
    Right. There always might be exceptions though, but it's not typical that 16000 functions are called at the same time, unless you did something very wrong.
    Quote Originally Posted by kohlrak
    Yea, but somthing has to come from some where. This means, something non C++ or non C has to be hidden some where. I'm a bit curious how they got this forign stuff in without any errors...
    That's where standards and APIs and drivers come in. They just do the stuff, so you should't have to care about how it's done. It's just done, somehow.
    Quote Originally Posted by kohlrak
    Like who? You know it's pretty well not optimized if microsoft written it. No one knows assembly so no one'd know, yet using Visual C++ is the best choice for windows, because of all the APIs for visual C++ only, but then we're once again stuck with unoptimized crap.
    Get gcc then, it's open source. Meaning that anyone that found anything that was worth improving, did so. Resulting in great speed/stability/reliability/whatever. Also, not all APIs are Visual C++ only. OpenGL and glut (things I used for graphics and input) both work perfectly well under Linux, too. But I agree, there are far too many Win-only stuff.
    Quote Originally Posted by kohlrak
    Well, i think that stuff would be built in the ASM code, though, since ASM is direct processor code.
    Yes, ASM is direct processor code. What does that have to do with how large memory blocks are assigned to an individual variable type? Nothing.

    Quote Originally Posted by kohlrak
    Well, like i said, i'm sure there is a bunch of junk in there that isn't even used. If it's not used, it's not needed and can be safely cut out. Alot of the exception codes that you can see with a hex editor which is put into the code, could easily be cured. If you have your own code in you own program with exceptions because you need it to be a certain range, why have a set of exception checkers and such that check for values over your ranges in both directions? In other words, there is stuff in there that protects code from going too high, but if you have an if statement or such that handles the thing for another value, isn't that exception handle of the higher value worhtless? Wouldn't that junk be worth cutting out and just kill everything that depends on that code and the dependencies of that. No adding, just removing a heck of a lot, and depending how often junk like that is called, could put it at the same speed as ASM code. Plus dramatically cut down on the mem needed.
    Yeah, optimizing. If something seems slow, code your version of it, to see if it's faster. If it IS, use it, if not, revert. However...
    Have you ever checked out Cassini, the "Open Source" Saturn Emulator? Those fools just disassembled the code, and put the ~2MB of assembler into a text file. See if you can improve it in a hundred million years.
    Truly, ASM is not pleasant to the eye in the case of larger programs. It is good for making a select few functions smaller/faster, though, but you don't need a disassembler for that.
    Quote Originally Posted by kohlrak
    Thing is, i was using a C++ compiler. And objects don't really have that protection that you think they do. I crash all the time, especially cause string can't be initialized. I'm guessing "cout <<" was horribly coded with a while loop and a call to printf or something of the sort. And i thought C was object oriented. I thought anything with functions was object oriented. And heck, aren't structs mearly C's way of calling objects similar to C++ only without operator overloading?
    Object orientation is an approach to programming, a programming method itself, alternative to structured programming, it has nothing to do with the actual datatypes themselves.
    In structured programming, you make loops and functions to handle the data.
    In object oriented programming, you make objects that are autonomous in some way, and have them go at it. The thing is that here the data is contained in the objects themselves, and is not manipulated from the outside. The objects re-assign their inner variables according to various instructions you may give them, and then behave accordingly. So, you could have a Player object, with a Jump method, that would make it jump, without you having to care about the exact details (collision, velocity, animation).
    BTW, the difference between structs and classes in C++ is that structs data fields default to public, whereas classes' default to private. There is no private/public distinction in C, therefore no need for classes.

  2. #2
    Join Date
    Apr 2005
    Location
    Pennsylvania, USA
    Posts
    520
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by pkt-zer0
    Right. There always might be exceptions though, but it's not typical that 16000 functions are called at the same time, unless you did something very wrong.
    I don't think it's possible to make that bad of a mistake...

    That's where standards and APIs and drivers come in. They just do the stuff, so you should't have to care about how it's done. It's just done, somehow.
    One should worrry, it also goes through the processor like everything else. What if there is a faster way? Plus, i'm curious how they introduce forign things into it. The information could make things possible in the long run. Like calling VB functions from VB's OCX or whatever they are (their dlls i think they are) and using some of those functions. You don't see the point now, but think of it in other ways, such as, calling assembly code or doing things with C++ that directly mess with the hardware? Perhaps you want to make a program in C++ that overclocks or somthing like that. Or how about hardware drivers in C++! I thought that's what the << and >> was for anyway.

    Get gcc then, it's open source. Meaning that anyone that found anything that was worth improving, did so. Resulting in great speed/stability/reliability/whatever. Also, not all APIs are Visual C++ only. OpenGL and glut (things I used for graphics and input) both work perfectly well under Linux, too. But I agree, there are far too many Win-only stuff.
    Well, there are alot of things that are... Plus, i keep trying to get it but i can never find the thing.

    Yes, ASM is direct processor code. What does that have to do with how large memory blocks are assigned to an individual variable type? Nothing.
    Processor processes the program, that means everything in it, therefor it reads what the OS says, therefor, assembly should have the last word even over the OS if the assembly code says so because it's send directly to the processor over the OS. We forget here, the processor is the computer itself and makes all the choices, the OS is just another program the processor calculates.

    Yeah, optimizing. If something seems slow, code your version of it, to see if it's faster. If it IS, use it, if not, revert. However...
    Have you ever checked out Cassini, the "Open Source" Saturn Emulator? Those fools just disassembled the code, and put the ~2MB of assembler into a text file. See if you can improve it in a hundred million years.
    Truly, ASM is not pleasant to the eye in the case of larger programs. It is good for making a select few functions smaller/faster, though, but you don't need a disassembler for that.
    Yea you do... Unless you know of a program that could convert some other things back to C or C++ so we can optimise it.

    Object orientation is an approach to programming, a programming method itself, alternative to structured programming, it has nothing to do with the actual datatypes themselves.
    In structured programming, you make loops and functions to handle the data.
    In object oriented programming, you make objects that are autonomous in some way, and have them go at it. The thing is that here the data is contained in the objects themselves, and is not manipulated from the outside. The objects re-assign their inner variables according to various instructions you may give them, and then behave accordingly. So, you could have a Player object, with a Jump method, that would make it jump, without you having to care about the exact details (collision, velocity, animation).
    BTW, the difference between structs and classes in C++ is that structs data fields default to public, whereas classes' default to private. There is no private/public distinction in C, therefore no need for classes.
    Exactly, therefor C is also object oriented.... Actually, with a little intellegence (and alot of hard to read code) you could actually use namespaces to as classes to do the same thing as objects. Only, you'd have to copy and paste the namespaces and rename them to make new objects. lol

    That also means, you could emulate object orientation in structured language... What scares me is those languages that don't use functions or objects. o.o i think VB's one of them. lol

  3. #3
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Quote Originally Posted by kohlrak
    One should worrry, it also goes through the processor like everything else. What if there is a faster way? Plus, i'm curious how they introduce forign things into it. The information could make things possible in the long run. Like calling VB functions from VB's OCX or whatever they are (their dlls i think they are) and using some of those functions. You don't see the point now, but think of it in other ways, such as, calling assembly code or doing things with C++ that directly mess with the hardware? Perhaps you want to make a program in C++ that overclocks or somthing like that. Or how about hardware drivers in C++! I thought that's what the << and >> was for anyway.
    Learn to code drivers, then. Some people do that, too, I can't help it that I'm not interested.
    Quote Originally Posted by kohlrak
    Well, there are alot of things that are... Plus, i keep trying to get it but i can never find the thing.
    The easiest thing would probably be for you to get Dev-C++, a graphical developer interface + minimal unix shell + gcc as compiler.
    Quote Originally Posted by kohlrak
    Processor processes the program, that means everything in it, therefor it reads what the OS says, therefor, assembly should have the last word even over the OS if the assembly code says so because it's send directly to the processor over the OS. We forget here, the processor is the computer itself and makes all the choices, the OS is just another program the processor calculates.
    Hey. I only said that you don't need to go down to assembly level to redefine some constanst. Or make any other working program, for that matter. There are many more optimalizations that could be made on higher levels, like replacing certain algorithms.
    Quote Originally Posted by kohlrak
    Yea you do... Unless you know of a program that could convert some other things back to C or C++ so we can optimise it.
    What I said above. Assembler is not the ultimate cure for slow speed. A crappy algorithm won't be any faster, even when it's written in ASM.


    Quote Originally Posted by kohlrak
    Exactly, therefor C is also object oriented.... Actually, with a little intellegence (and alot of hard to read code) you could actually use namespaces to as classes to do the same thing as objects. Only, you'd have to copy and paste the namespaces and rename them to make new objects. lol
    That also means, you could emulate object orientation in structured language... What scares me is those languages that don't use functions or objects. o.o i think VB's one of them. lol
    The thing is that by removing the extended functionality that C++ provides, you'd be having to make a lot of complex code syntaxes, making it hard to read. For example, due to lack of operator overloading, you'd always have to use certain functions, getting real ugly. That would kinda kick the concept of 'OOP being friendlier to use' in the nuts.

  4. #4
    Join Date
    Apr 2005
    Location
    Pennsylvania, USA
    Posts
    520
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by pkt-zer0
    Learn to code drivers, then. Some people do that, too, I can't help it that I'm not interested.
    True..

    The easiest thing would probably be for you to get Dev-C++, a graphical developer interface + minimal unix shell + gcc as compiler.
    I have that... No offence, it sucks for practical use, i'd only use it to learn. Alot of code dosn't even work with it. Like wchar_t... Talk about unsupported...

    Hey. I only said that you don't need to go down to assembly level to redefine some constanst. Or make any other working program, for that matter. There are many more optimalizations that could be made on higher levels, like replacing certain algorithms.
    Be much easier... lol

    What I said above. Assembler is not the ultimate cure for slow speed. A crappy algorithm won't be any faster, even when it's written in ASM.
    Aye, but the perfect aligorithm can only be made in assembly.

    The thing is that by removing the extended functionality that C++ provides, you'd be having to make a lot of complex code syntaxes, making it hard to read. For example, due to lack of operator overloading, you'd always have to use certain functions, getting real ugly. That would kinda kick the concept of 'OOP being friendlier to use' in the nuts.
    Right, but still... C is OOP. That's the point i'm trying to make. lol Yes, it's not super good looking OOP like C++ but it's still OOP.

  5. #5
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Quote Originally Posted by kohlrak
    Aye, but the perfect aligorithm can only be made in assembly.
    No. Algorithms are still just maths. I mean, that's a proper application for mathemathical knowledge, algorithm construction. It has nothing to do with coding.
    Implementing an algorithm, however, is another matter. And you wouldn't need to code that in assembler, either, if said C code would convert to the fastest possible ASM code.
    Quote Originally Posted by kohlrak
    Right, but still... C is OOP. That's the point i'm trying to make. lol Yes, it's not super good looking OOP like C++ but it's still OOP.
    Nope. C is a programming language, OOP is a programming method. It's like comparing apples and oranges. You could just as well say that ASM is OOP, since any code gets turned into machine code in the end.
    The methods provided by the C language were not meant to make object oriented programming easy, whereas those in C++ were. That's the difference.

  6. #6
    Join Date
    Apr 2005
    Location
    Pennsylvania, USA
    Posts
    520
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by pkt-zer0
    No. Algorithms are still just maths. I mean, that's a proper application for mathemathical knowledge, algorithm construction. It has nothing to do with coding.
    Implementing an algorithm, however, is another matter. And you wouldn't need to code that in assembler, either, if said C code would convert to the fastest possible ASM code.
    Then C is the next best thing... Still not the best. The fastest algorithm really shouldn't be auto generated, which comes with compilers.

    Nope. C is a programming language, OOP is a programming method. It's like comparing apples and oranges. You could just as well say that ASM is OOP, since any code gets turned into machine code in the end.
    The methods provided by the C language were not meant to make object oriented programming easy, whereas those in C++ were. That's the difference.
    That'd be saying the only OOP one out there would be C++, while java is also on that list. I don't recall operator overloading and such in java. Then again never completed the tutorial... Anyway, C has objects, C has your functions, C has everything C++ has except maybe exceptions (not sure or not) and operator overloading. Other than that, you could easily convert C++ back to C.

  7. #7
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Quote Originally Posted by kohlrak
    Then C is the next best thing... Still not the best. The fastest algorithm really shouldn't be auto generated, which comes with compilers.
    I was trying to point out that you can add the first n integer numbers either by

    a) a for loop that goes from 1 to n, and adds the current value to a variable, which then holds the correct sum by the end of the process.
    b) compute n*(n+1)/2.

    Both can be written in C and ASM, version b) is obviously faster, even if you write version a) is assembler.

    Quote Originally Posted by kohlrak
    That'd be saying the only OOP one out there would be C++, while java is also on that list. I don't recall operator overloading and such in java. Then again never completed the tutorial... Anyway, C has objects, C has your functions, C has everything C++ has except maybe exceptions (not sure or not) and operator overloading. Other than that, you could easily convert C++ back to C.
    I never said C++ was the only OOP language, I just said that C wasn't. Also, you don't have member functions in C (I think), but you can assign function pointers to member fields, and access functions indirectly that way. Also, as I said, no private fields in C, thereby screwing the data-safety concept of OOP.
    About Java... I pretty sure you could code your own objects there, as well. And that would mean that you wouldn't even need to use objects there, either. Not that you wouldn't want to use them, but still.

    So, you're still saying ASM is an OOP language as well? Since all code is machine code, in the end?

    Anyway, to illustrate my point further. Let's say you write a book about a given topic. You might still choose different styles to write it (prose or verse, etc.), but it would still be about the same topic. (Coding methods, OOP and SP, for example.)
    And on top of that, you might even write it in different languages (English, Spanish, etc.), but it would still mean the same thing, still use the same style. (Programming languages, like C, C++, Java, for example.)
    What you're saying is basically that Spanish is prose, and English is prose as well, whereas Spanish might be verse, too. See how absurd it is?

    On the other hand, one language might be better suited for some styles, rather than others.

Similar Threads

  1. Visit The Hang Out!
    By Georgyw5k in forum Free 4 All
    Replies: 5
    Last Post: 28th-November-2003, 05:18
  2. Do You Hang Up On Advertisement Callers?
    By ((KvN)) in forum Free 4 All
    Replies: 52
    Last Post: 21st-July-2003, 11:16

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About Us

We are the oldest retro gaming forum on the internet. The goal of our community is the complete preservation of all retro video games. Started in 2001 as EmuParadise Forums, our community has grown over the past 18 years into one of the biggest gaming platforms on the internet.

Social