Search:

Type: Posts; User: EVOEx

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds; generated 38 minute(s) ago.

  1. Replies
    3
    Views
    1,267

    I'd like to add that you really, really shouldn't...

    I'd like to add that you really, really shouldn't use:


    char *name3 = "Chennai" , *name4 = "Chennai" ;


    As the strings are constants. Changing them will result in undefined behaviour (usually...
  2. Replies
    14
    Views
    2,067

    As already posted in the other thread:...

    As already posted in the other thread: map.find(str.substr(index,4))->second may crash, if map.find(...) returns map.end(). You should compare it to that before you dereference the iterator.
    
  3. Replies
    13
    Views
    1,867

    One possibility is that map.find(...) returns...

    One possibility is that map.find(...) returns map.end(). map.end()->second is not valid.



    Actually, I take that back. Apparently he *was* acting on 4 characters at a time. Though to be fair,...
  4. Replies
    13
    Views
    1,867

    Ah, I misread the OP. I thought he acted upon...

    Ah, I misread the OP. I thought he acted upon groups of 4 characters, ie. in the first loop iteration read/write the character with indices 0 through 3. I see now that there is little reason to...
  5. Replies
    13
    Views
    1,867

    Imagine a three character string, "abc". i = 0,...

    Imagine a three character string, "abc".
    i = 0, so i < str.size() (= 3). The loop body will execute and assume there are 4 characters, reading past the end of the buffer. Instead, you'll want:

    ...
  6. Replies
    3
    Views
    901

    You definitely should NOT be using strcat. You...

    You definitely should NOT be using strcat. You should be reading in a C++ string (std::string), not a C-string (char buf[...]). After that, you can simply add it by saying either:


    buf2 += '*';...
  7. Thread: C++11 Args...

    by EVOEx
    Replies
    1
    Views
    1,434

    The class is written to take "std::istream" to...

    The class is written to take "std::istream" to process the arguments. std::istream is not specific to std::cin, std::istringstream is derived from std::istream as well. So you should just be able to...
  8. Replies
    4
    Views
    2,703

    Ok thanks for your answer! I'm going to spend...

    Ok thanks for your answer! I'm going to spend some time considering this ;-).
  9. Replies
    4
    Views
    2,703

    Thanks for your reply! I think I agree with that...

    Thanks for your reply! I think I agree with that - though many event based systems do seem to allow a return value.

    Anybody who disagrees with this?
  10. Replies
    4
    Views
    2,703

    Event based system design

    Hi everybody,

    I'm considering implementing a general purpose event-based system in C++. Events will be asynchronous. My question regarding design is: should event handlers have a return value, or...
  11. Replies
    10
    Views
    5,454

    Right. I didn't even know I had the "clang"...

    Right. I didn't even know I had the "clang" command. Mac's a bit of a mess compiler wise. See:


    $ cat /tmp/a.c
    #define F2(x, y) x##y
    #define F1(x, y) F2(x, y)
    #define TEST(x) F1(x,...
  12. Replies
    10
    Views
    5,454

    Yes, __LINE__ worked, __COUNTER__ didn't. As I...

    Yes, __LINE__ worked, __COUNTER__ didn't. As I explained in the second post, __COUNTER__ isn't expanded at all (it did work with make as it used gcc, it didn't with gcc as it used llvm). But...
  13. Replies
    10
    Views
    5,454

    Actually, it seems that __COUNTER__ doesn't work...

    Actually, it seems that __COUNTER__ doesn't work at all. It seemed to work when I compiled with "make", as my Mac is a bit of a mess with several compilers installed. But even a basic app like this:...
  14. Replies
    10
    Views
    5,454

    LLVM __COUNTER__ Macro not expanding

    Hi everybody,

    I'm using the LLVM compiler at the moment. I've written the following (test) code:


    #define F2(x, y) x##y
    #define F1(x, y) F2(x, y)
    #define TEST(x) F1(x, __COUNTER__)
    ...
  15. Replies
    4
    Views
    1,228

    A few comments: 1. To debug segfaults, run the...

    A few comments:
    1. To debug segfaults, run the application through valgrind. Simply install it, and prepend "valgrind" to the command, and voila, you know where it crashed and why.
    2. The usleep...
  16. Replies
    3
    Views
    3,811

    Thanks for your replies! Actually, I've found...

    Thanks for your replies!

    Actually, I've found a big issue with my method: the fact that it doesn't seem to be able to derive the type of the constructor's arguments. For example, for a matrix, if...
  17. Replies
    3
    Views
    3,811

    C++11 Vector class initialization

    Hi everybody,

    I'm working on a vector class - the mathematical kind - for C++11. I'm trying to find a decent way for initialization, such as:


    Vector<3> v{ 0, 1, 2 };


    My first idea was to...
  18. Replies
    4
    Views
    1,520

    Ahh, that makes sense, thanks! The reference I...

    Ahh, that makes sense, thanks!

    The reference I was looking at (allocator - C++ Reference) completely ignores rebind...


    Thanks!
  19. Replies
    4
    Views
    1,520

    Custom allocators

    Hi everybody,

    I was looking through custom allocators. For example std::set is defined as follows:


    template < class Key, class Compare = less<Key>,
    class Allocator =...
  20. Replies
    5
    Views
    1,627

    Thanks for your answer! Of course I'm not...

    Thanks for your answer!

    Of course I'm not going to make a PHP daemon for this purpose, that was in reply to MK27's comment that PHP can be fast enough for this just fine. Of course I could...
  21. Replies
    5
    Views
    1,627

    Thanks for your replies guys! But my issue...

    Thanks for your replies guys!

    But my issue with a multiplier is that the score has to be calculated for each row in the table, for each user. If the number of rows and/or the number of users...
  22. Replies
    5
    Views
    1,627

    Matching data to users

    Hi everybody,

    I'm building a website in which I want to match events (concerts, fun thing to do in the area, etc.) to users. These events should be constrained to a location on either a country,...
  23. Replies
    16
    Views
    6,391

    Okay, makes sense now... Thanks very much, guys!

    Okay, makes sense now... Thanks very much, guys!
  24. Replies
    16
    Views
    6,391

    I guess I didn't understand volatile as well as I...

    I guess I didn't understand volatile as well as I thought, then (sorry for my confusion). The code more accurately looks like this (should've written this in the first place):


    class SomeClass {...
  25. Replies
    16
    Views
    6,391

    There were some changes I hadn't read ;-). But...

    There were some changes I hadn't read ;-). But what exactly do you mean by "an atomic"?

    Also, if I would have an object in the class, say:


    std::queue<Task*> tasks_;


    Would this need to be...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4