Xupicor's Profile User Rating: *****

Reputation: 377 Architect
Active Posts:
968 (0.54 per day)
31-May 11
Profile Views:
Last Active:
User is offline Yesterday, 07:08 AM

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Favorite Gaming Platform:
Your Car:
Who Cares
Dream Kudos:

Latest Visitors

Icon   Xupicor is off the grid for a couple of days.

Posts I've Made

  1. In Topic: Organizing and Working with Classes and Objects

    Posted 17 Dec 2015


    about headers: should classes which basically belong together be concluded in one header? Like for example a header "bank.hpp" where you define a customer, account etc. class?

    It's your choice. If you have an important/big class and one or two accompanying helper/wrapper/tightly bound classes that are very small - you may choose to have them all in one place for convenience. Now, do you want all your classes in one single file? Probably not. That's your choice to make, though.


    I don't think it is like in Java, where every class should use a new file (in this case bank.hpp, customer.hpp, account.hpp)

    In Java every class _should_ be in its own file, but doesn't necessarily have to. You can have multiple classes in a single file, but you have to be aware of how that works and of some limitations involved. ;)

    Also, you do know that you can (sometimes have to, sometimes want to) split the header file with declarations (.h, .hpp*...) from the implementation file with definitions (.cpp, .cxx...), right? It helps compilation times on subsequent compilations, at a cost of duplicating some information.

    *) though, there exists a convention of .hpp files being used as self-contained headers, as in - the definitions/implementations are all there, there's no accompanying .cpp file. Common with templates.

    However, as is the case with conventions - it's not the only one. There are others that use .h only for C headers, or C++ that's made compatible with C headers - so that if you include .h you know it's safe in C. By that logic .hpp (.hh, .hxx...) is used for C++-only headers, regardless if the implementation is self-contained or in accompanying .cpp - thus in C-land you know not to include those.
    That's, again, your choice to make what kind of convention you wish to follow - or if at all.
  2. In Topic: program crashes. I think malloc() wrong

    Posted 16 Dec 2015

    The issue is - why use a dynamic array of pointers to structure, when you can just have a pointer to structure and malloc memory for n structures. ;)
  3. In Topic: program crashes. I think malloc() wrong

    Posted 16 Dec 2015

      /*Dhlwsh stigmiotypwn poy apothikeyontai dynamika sthn mnhmh */
      struct Rental** listOfRentals;
       /* Dynamikh apo8hkeysh me xrhsh malloc() */
      listOfRentals =(struct Rental**) malloc(sizeof(struct Rental*) * listSize);
      /* elegxos se periptwsh pou den yparxei arketos xwros */
      if (listOfRentals==NULL){
         printf("\nOUt of memory");
         return (-1);
      for (j=0; j<listSize; j++)
            listOfRentals[j] =((struct Rental*)malloc(sizeof(struct Rental)*listSize));
            if ((listOfRentals[j])==NULL)
            printf("\nOUt of memory");
            return (-1);

    Can you explain what you're doing here?
    That was already rightfully called out by jjl even before you posted the code. Do you need a pointer to a pointer? Because as is you have a list of lists of Rentals (or rather, an array of arrays... or rather... oh I'll stop here :P).
    Seeing how you use listOfRentals[currentRental]->carLicense - I'd go on a limb and say that you're wasting (sizeof struct Rental*) * listSize + (sizeof struct Rental) * (listSize - 1) bytes of memory in your program.
  4. In Topic: program crashes. I think malloc() wrong

    Posted 14 Dec 2015

    I was under the impression that you were under time constraints? Why not address those previous points in code and get back to us with it?
    Did you run your program with a debugger to see where it crashes?
  5. In Topic: More advanced uses for scope guards

    Posted 14 Dec 2015

    That's interesting.
    I'll get to the video a bit later in the day, in the meantime - would it be to much to ask for a more involved example of, say, SCOPE_FAILURE? In your example, specifically, what if open() throws?

    Also, not that it matters much since the support as far as I can tell is wide - but __COUNTER__ surprisingly isn't standard, right?

My Information

Member Title:
Nasal Demon
30 years old
March 20, 1986
Rokietnica, podkarpackie, Poland
Programming, IT, bits of cosmology and philosophy, history (focusing on WWII lately), s-f (Asimov, Lem, Dick...) and fantasy (Tolkien, Sapkowski, Le Guin, Modesitt...) books, good movies (Tarantino, Nolan, Polański, Scorsese, Kurosawa, Kubrick... and more), sometimes an anime movie or series (Ghost in the Shell, Cowboy Bebop, LoGH, House of Five Leaves, Mononoke, etc). I enjoy playing RTS and RPG games (that includes browser text-based fable-driven ones), and sometimes hunting my pals as an alien in AvP2, or playing as a platoon commander (or helicopter pilot) in Battlefield 2.
Full Name:
Tomasz Wota
Years Programming:
Programming Languages:
Pretty good: C, C++, PHP
Not too shabby: Java, JavaScript, Python
Bit rusty: Perl
Can't remember a thing: Atari 128 & Commodore 64 BASIC, Pascal
Learning (or planning to): C#, LUA, Haskell, Scala
Thinking about glancing trough: Mathematica, D, Objective-C, Go, R, Clojure, Curl (not libcurl :P)

Contact Information



  • (7 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  1. Photo

    Anarion Icon

    31 Aug 2015 - 05:20
    Interesting! I was thinking about doing some work similar to what you say a few weeks back but haven't started yet, or even finalized my decision to do that. I think we should discuss that sometime?
  2. Photo

    Anarion Icon

    26 Aug 2015 - 12:03
    You had some neat pieces of advice there. Couldn't stop myself from voting! Especially the references to the standard. Concise and to the point! ;)
  3. Photo

    .Aaron Icon

    07 Feb 2014 - 15:43
    "Twilight zone it is. That's where aresh lives, actually. ;)"
    Lol. Yea.. I'll believe that.
  4. Photo

    jesicalbaby Icon

    16 Sep 2013 - 14:02
    My name is Miss jesical,
    i saw your profile today
    and,i fill more interest to contact you ,
    i will like you to please send me
    an email via ([email protected])
    for me to send you my picture
    [email protected]
  5. Photo

    aresh Icon

    17 Aug 2013 - 06:20
    Is our love also dead?
  6. Photo

    aresh Icon

    14 Aug 2013 - 03:10
    You liar, now you'll even kill your mother just to break off with me? I'm offended... My skills in bed aren't that bad, you know.. :(
  7. Photo

    aresh Icon

    13 Aug 2013 - 01:37
    No, it's not. I've seen you naked, doing the dance for me. The fact that your mom caught us at that moment changes nothing!
    Traitor! :'(
  8. Photo

    aresh Icon

    05 Aug 2013 - 07:50
    After we slept together last time, you didn't even bother to call me once? You traitor!
  9. Photo

    aresh Icon

    05 Jun 2013 - 10:21
    And I see you're seeing my profile... I got myself a stalker, huh? ;)
  10. Photo

    aresh Icon

    05 Jun 2013 - 10:21
    Ya know, Surely You're Joking was awesome, but What do you care wasn't all that superb..
  11. Photo

    aresh Icon

    04 Jun 2013 - 17:33
    Oh, and I also talk to myself, especially when solving a problem or thinking about something :P
  12. Photo

    aresh Icon

    04 Jun 2013 - 17:32
    His name is funny enough as it is :P
    And I also think people stare at me -.-
  13. Photo

    aresh Icon

    04 Jun 2013 - 16:28
    Come on, with your skills, you should be able to find a job in IT pretty soon.
    BTW, I completed Surely You're Joking, Mr Feynman, and it was awesome ^_^
  14. Photo

    aresh Icon

    03 Jun 2013 - 17:40
    Ya know, the book which you recommended is not exactly a novel, but it's good nonetheless. I am enjoying reading it :D
  15. Photo

    aresh Icon

    03 Jun 2013 - 15:30
    Well, will be sure to check them out :)
    Other than that, how's your life going?
  • (7 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »