Jump to content

jollyrancher82

Dedicated Members
  • Posts

    919
  • Joined

  • Last visited

Posts posted by jollyrancher82

  1. I'll have to disagree, mixing assembly and c++ is a great way to speed up your application. Inline assembly is not the only way to do assembly!

    *snip*

    You shouldn't use inline assembly "just because you can" in an application. There are certain situations when it is good, and the rest are bad and offer no benefit. The performance of a desktop application depends on what it's being used for, or the platform it's being run on. If you're writing a C++ application, the likelihood of it needed to be "fast" is slim. If you were writing a performance dependent application you would write the whole application in assembly.

    Also I already know the different assembly syntax's of inline assembly. I also know how parameters are passed. You don't need to prove to me you know this stuff. I don't care if you do, or don't understand it. I am offering my advice based on what is presented.

  2. well thanks TomB and CrashandDie for your feedback! That's another reason I post my code, so people can tell me what they feel is wrong with it... I'm not set in my ways so I'm open to changing my coding style..

    Feedback helps developers understand different ways of accomplishing the same goals.

    I advertise it as C++, because I never started with C... I went str8 to C++. Even thought they are similar, they are different still...

    Object Oriented Programming? I don't think you've looked at the code enough... Well my Winsock CLASSES are in there in EasySockets.h and in my code I create xClient objects... I can create a client object or a server object and use them...

    In this app I only need to use the client object... Maybe you missed the parts which contained this line?

    xClient* cli = new xClient;

    that creates a new xClient object, and also a pointer to it...

    then it can be used like so:

    cli->ConnectToServer("hak5.org", 80);
    sendx(cli->serversock, buffertosend, sendbuffersize);
    recvx(cli->serversock, recvbuffer, numberofbytestorecieve);
    
    //if done close connection or do more sending and receiving first
    cli->Close();
    
    //clean up
    delete cli;

    I created the xClient + xServer classes as I started using winsock in a lot of my apps, and I disliked repeatedly having the same code everywhere. I mean that's why we create functions right? Make functions which do all the dirty work, then you can just call them. Which in turn makes your code look more neat. So I created a simple class for client and server communication which works very well ;)

    I have a similar solution for winsock, except I use polymorphism, and inheritence.

    Well your not always going to be allocating memory for an 'object'. I always use new for creating class objects, but for raw memory, where a buffer will be, or some other kind of data which is just data and does not include functions, Allocating memory is allocating memory. How you do it shouldn't matter, as long as the memory is allocated I don't see a problem with it... That being said as long as your not allocating the memory on the STACK, your fine... As stack memory is limited and shouldn't be used for large buffers...

    However I will try to start using new, and stop using malloc()! However I still don't see a problem with using VirtualAlloc and I'll continue to use that!

    You should use new/delete in C++ without question. I can't remember off the top of my head but I believe VirtualAlloc uses new or new uses VirtualAlloc, I forget which way around it is.

    as for the char*

    yes char* is a pointer to a single character, but there isn't a way to make something point to many characters at once... and it wouldn't make sense either...

    What I mean is, even though its a pointer to 1 character, what comes after it? usually another character, and another and another, until a NULL terminating character is reached. null terminator is binary 0

    I guess since I'm so used to assembly I don't think of things in terms of syntax. I think of what needs to be done on machine level. Like okay I need to allocate some memory to store my buffer, while simultaneously creating a pointer to it. Then I can use that pointer to write to it, or read from it, add to the pointer to move up in it, or subtract from it to move backward. Find strings in it if necessary by comparing bytes in the buffer to bytes in the string, etc...

    Think of it this way... even though in C++ you know a "char*" is a pointer to a char... what does it really come down to on machine level?

    Your "char*" is simply is a 32bit(DWORD) value which holds the address of the character it points to! So you see what I'm getting at?

    C++ is very strict with syntax while assembly is not... So type casting must be used frequently, And I'm fine with that. But I like being able to relax with ASM and just deal with DWORDS! :)

    I guess it just depends on if you like manually handling memory allocation for your strings yourself...

    I am starting to see the goodness of using std::string though, and I will definitely start using that instead of char*

    Mixing assembly with C++ can be a good and bad thing. Different compilers have different inline asm syntax. I like the idea behind the string class however I wrote my own slimline string class for C++.

    the header files to put classes and functions in, I will (for the most part) stop putting functions and classes in header files, only because of the "inline" issue which you mentioned, that's something I wasn't aware of thanks for letting me know that...

    Also I won't ever put a ton of shit in a few files... But I also wont put a little code in a million files! I'll find somewhere in the middle and stay there ;)

    It's never a bad thing to have many files, it's good management and allows you to know where everything is. I work a lot with OOP. So I generally have the class definition in a header, and the implementation in the source file. This never gets messy and I find it easy to manage knowing where everything is.

  3. Software that is provided FREE on the other hand I believe should be open source! Since your providing it for free anyway and have no plans to go commercial with it, whats the harm in giving out the source?

    I write free software but I don't give out the source because you get people that edit it and put their names on it, or "borrow" code from it without giving credit where it's due.

  4. | and & are bitwise or and and respectively. || and && are logical or and and respectively.

    if(retval == -1 | retval == 0)

    This code is performing a bitwise or operation.

    if (retval == -1 || retval == 0)

    This is the code that should be used.

    Also the idea behind multiple source files is for organisation. Having source in single files is untidy, and unorganised. If you plan on going into programming as career you should look into managing source files better.

  5. What do you have against open source? Most of the apps I created are all OPEN SOURCE!

    I like open sourcing my apps, because then people can see what my code is doing! and understand whats going on with it. And it just may even help them out, if my code contains a solution to a problem they've had ;)

    I have nothing against open source. I have something against the people and communities that preace open source is better and that all software should be open source. This is also the reason I am not a fan of Linux and it's community. My software is released as closed source, whether people use it or not because of this reason is up to them. I write my software for the research and learning for me, people using it is a bonus. If people want to know how a certain piece of my software works, I happily share that piece of code, but not everything.

  6. Why are you using malloc() and free() in C++? You should be using new and delete.

    if(retval == -1 | retval == 0)

    Found this in EasySockets.h, I don't know if you meant || or you wanted to use |.

    You should also separate classes into .h and .cpp. Headers are for class definitions, and the .cpp file is for the class implementation.

  7. I've been programming for around 7 years now. I tinkered around with BASIC until I started off learning how to create web pages with HTML, soon using CSS. Then I took a break, came back and learnt PHP. Once I grasped PHP, I moved onto C, having learnt PHP C came across as simple. I soon added SQL to the list of languages learnt and this helped me with PHP and databases. Then I became more interested in different languages; Perl, Objective-C, and others. I then moved onto C++ learning pretty quickly about the OOP side of it having already got the hang of C. Then I started to dabble in OSDev, so I picked up assembly pretty quick. Got interested more in assembly so I looked into writing 32 bit apps using MASM. I then moved onto mainly working in C/C++ with Win32 API. Over the last year I've been using C# and ASP.NET for some projects. If any new language comes around that looks interesting I'll probably pick that up too.

    For a more in-depth look at what I've learnt over the years you can visit: http://tombell.org.uk/blog/about/

  8. You were using functions specific to the 9.0 runtime.

    As for the .NET dependency for C#, most up to date Windows systems have the latest .NET framework installed.

    So if your thinking about coding whatever language that may be! LEARN ASSEMBLY FIRST! I'm not saying you have to become a pro assembly coder overnight! But just learn the basics at least! It will help you out no matter what your coding language of choice is!! trust me! smile.gif

    I also believe this is bad advice. Don't learn Assembly as your first language.

  9. Or you can google for it,

    Its not that a big of a secret.

    Personaly i just like to see that people just use the Fon routers for what there mend for and thats charing your internet connection, and if you are not content with the Fon router or rules just give your fon Router to someone thats willing to share its internet connection and will accept the fon rules.

    Gerard

    If you're against modding hardware.. WHY exactly are you hanging around this community? This is one of the very meanings of "hacking", making something do something it shouldn't.

  10. I have a real fear this could realy cruel firefox whose constant efforts I have come to admire. I tried Chrome and it does most things I want it to do but for the moment I will stay loyal to Firefox.

    I use the best tool for the job, if Chrome is better than Firefox in my opinion, I'll use it over Firefox. At the end of the day it's just a web browser, and I don't give two hoots about the philosophy behind it.

  11. Google has such a wide user base, it's natural to think people will be using it's browser a lot in the future. I can see it taking off, but I personally don't like either FF or Chrome. I tried Chrome, but it really just seems like a stripped down browser with no real features yet. For search, I'll just go to my homepage(which is set to google anyway).

    No real features? It does what a web browser is suppose to do, browse the web. Too many people have become used to all the extras in Firefox they think all web browsers should be packaged with them. Sometimes people just want a web browser, not something that cooks, cleans, and gives you a... nevermind.

    Everyone is so quick to find flaws with new applications released it's unbelievable. I currently use Chrome as my main browser, and I've never missed any addons I had installed in Firefox. I prefer minimalist applications, and Chrome's user interface pulls it off.

    The install part sounds a bit shady to me, as it should come up with some other process before it just goes and starts doing things to our system (like an EULA or something with a "click ok to install" for consent or something or to cancel.) Instead of just doing whatever the hell it wants as soon as it opens it should not make any changes and give you the option to back out in the event that you change your mind. Most installers only create temp files and prompt you for the permission to install and give you the option to cancel it if you want to and they usually clean up after themselves, making no changes to any other part of your system.

    When you click download it goes to this page http://www.google.com/chrome/eula.html. So yes you do have the opportunity to cancel the download and read the EULA. It's web based installation, doesn't rely on user interaction making it simpler for non-techy people to use. Don't link the installer? Download the source and compile it yourself, it is open source after all.

×
×
  • Create New...