Search:

Type: Posts; User: joshuastuden

Search: Search took 0.01 seconds.

  1. Yes, that's exactly what it is, a MAC address....

    Yes, that's exactly what it is, a MAC address. Thanks!
  2. How to get the 20 least significant bits?

    I have some strings that come in over a REST interface that represent some network coordinates. The string looks something like:

    02:00:00:00:00:07

    Bits 5 - 0 represent tier 1
    bits 13 - 6...
  3. I no longer think this is correct. How do I...

    I no longer think this is correct. How do I ensure that the function returns a boolean?
  4. Thank you. This is very helpful. I can't seem to...

    Thank you. This is very helpful. I can't seem to call Monitor, though. I get a lot of compilation errors.

    I have




    bool compare(int a, int b, int c)
    {
    return a == b == c;
  5. But how do I know what parameters to pass into...

    But how do I know what parameters to pass into function() when I call it from monitor?
  6. Want a function that accepts either a bool value or a function ptr that returns bool

    Basically, I have a function called "monitor" and basically, this function works by waiting until some expression is false, and then it returns.

    Right now, for this specific instance, it compares...
  7. Right. What you've said is probably a better way...

    Right. What you've said is probably a better way to describe the question. Using memcpy didn't seem very C++-ish to me, so that's why I asked.

    Thanks.
  8. >But since std::string (and any properly...

    >But since std::string (and any properly programmed type with allocated data) will have overloaded operator=, using = will work just fine, copying both the basic structure data and also creating new...
  9. Is this a valid way to do a copy instead of a memcpy?

    Basically the lines in question below are


    queue[tail] = element;
    vs.
    memcpy(&queue[tail], &element, sizeof(T));


    Is...
  10. Too late. I fixed the problem. Your solution was...

    Too late. I fixed the problem. Your solution was useless.
  11. Thanks for this. How does the initialization list...

    Thanks for this. How does the initialization list help, though? It seems that "Stupid s" would still get created, then thrown away when the initialization list gets created... I supposed I can try it...
  12. It seems like to avoid this thing from taking up...

    It seems like to avoid this thing from taking up memory, I need to do Stupid *s and then use s = new Stupid(size);

    Am I correct?
  13. Hmm. It seems like that it's destroyed when the...

    Hmm. It seems like that it's destroyed when the Container object is destroyed. Effectively, it stays in memory despite not being used.
  14. When does this object instance get cleaned up?

    The situation I'm asking about is in the comments. Basically, when does "s" of type Stupid get cleared?



    class Stupid
    {
    int size;
    int *array;
    public:
    Stupid(){}
  15. Default constructor is different than what you...

    Default constructor is different than what you said. As I said, i removed it and got even different errors.
  16. Removing it is not correct. It actually spits out...

    Removing it is not correct. It actually spits out a whole slew of errors now.

    I don't think you can remove a constructor like this. I have actually reverted my code to a previous version where all...
  17. undefined reference to constructor of parent virtual class

    Basically, when the compiler tries to link this stuff into a "simpletest" executable (the simpletest.cpp with a main isn't included but I can if needed) it says it can't reference the constructor of...
  18. Replies
    3
    Views
    6,828

    I did indeed read that, but that solution has an...

    I did indeed read that, but that solution has an inherent race condition in it, which will certainly lead to buggy code.
  19. Replies
    3
    Views
    6,828

    mwait/monitor example

    Hi,

    I am trying to play around with the mwait and monitor concepts on intel processors (I have a KNL machine so these instructions are available).

    I can't, for the life of me, see how to...
  20. Replies
    7
    Views
    4,804

    Got it. Makes sense. For some reason, I thought...

    Got it. Makes sense. For some reason, I thought there was some way I could play around with the | or something like that, but this macro works perfectly.
  21. Replies
    7
    Views
    4,804

    Ah, I THINK I see... so my "acquire_segment"...

    Ah, I THINK I see... so my "acquire_segment" function would have to take an additional parameter "int flag" or something that gets passed to COND. writer_acquire_segment(seg, 1) and...
  22. Replies
    7
    Views
    4,804

    Thanks. Sorry for the syntax error, I just...

    Thanks. Sorry for the syntax error, I just quickly pasted something and forgot I was in the midst of changing the code before I pasted it.

    The COND macro looks interesting but I must say I am a...
  23. Replies
    7
    Views
    4,804

    How to generalize this while loop?

    I have two blocks of code that I feel can be generalized. I have a reader_acquire_segment function and a writer_acquire_segment function and I feel that the bulk of the code could be generalized to...
Results 1 to 23 of 23