Search:

Type: Posts; User: Marksman

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    10
    Views
    2,403

    Well, I posted it on Monday, so there goes that...

    Well, I posted it on Monday, so there goes that theorem ;)

    I will finish the program in a simple way first, but I was also asking out of curiosity.

    Also, the program is a memory latch-up test...
  2. Replies
    10
    Views
    2,403

    efficient bit manipulation of memory

    I have a large chunk of memory that I want to bit-wise complement. Since I want it to be fast, I don't really want to go byte by byte. What's the best way to do this?
    Here's a first implementation...
  3. Replies
    1
    Views
    4,023

    longest prefix

    Hi,

    I'm looking for an algorithm to find the longest prefix of a certain string. This is not longest common substring (not directly anyways).

    For example, for the strings
    string1 = "01234567"...
  4. Replies
    9
    Views
    13,131

    Argh! I forgot the braces around the switch...

    Argh! I forgot the braces around the switch statement in all of my examples...



    switch (val)
    {
    case 0:
    e1;
    e2;
    ...
  5. Replies
    9
    Views
    13,131

    Ah, Ok. I think I get it now. The actual code I...

    Ah, Ok. I think I get it now.
    The actual code I was working on looked like this:


    switch (val)
    case 0:
    e1;
    e2;
    ...
    en;
  6. Replies
    9
    Views
    13,131

    Ok, but why does it allow me to declare a...

    Ok, but why does it allow me to declare a variable if it's the second statement? seems like an arbirary rule, but I'm sure there's some explanation




    int main() {
    switch (0)
    case 0:
    ;...
  7. Replies
    9
    Views
    13,131

    declare variable in case statement

    Just wondering why exactly this produces an error in gcc:


    int main() {
    switch (0)
    case 0:
    int a;

    return 0;
    }
  8. Replies
    4
    Views
    23,558

    hmm,... actually I didn't expect funcB( &s ) to...

    hmm,... actually I didn't expect funcB( &s ) to work
    but I guess it does!

    I thought since s was already a reference, that taking the address of s would be some kind of a double pointer. But I...
  9. Replies
    4
    Views
    23,558

    convert reference to pointer?

    Hi,

    I have a function that gives me a string reference:

    int funcA (string &s)
    { ...}

    and within there I need to call a function that takes a void pointer:

    int funcB(void *v) { ...}
  10. Yeah you're right. I put the array outside of the...

    Yeah you're right. I put the array outside of the class definition and made it static.
  11. Hi, Thanks for your reply. Yes I should be more...

    Hi,
    Thanks for your reply.
    Yes I should be more clear. ch_map will be constant and the size will not change. Also there should be only 3 characters in the initialization strings (I actually was...
  12. how to initialize declared 2d character array

    Hi,

    I have a header file with a declaration like this:

    class MyClass
    {
    char ch_map[][4];
    }
    then in the cpp file I want to have something like this:
  13. Replies
    7
    Views
    1,178

    Yeah that's true. In my actual program I only had...

    Yeah that's true. In my actual program I only had 4 variables, so it was manageable.
    Otherwise the vector/list approach would definitely be better.
  14. Replies
    7
    Views
    1,178

    sorry I must have had a brain fart ... a < b...

    sorry I must have had a brain fart ...


    a < b && b < c && c < d

    etc...


    my post probably wasn't clear, I was just looking for that
  15. Replies
    7
    Views
    1,178

    Oh sorry, by 'order' I meant just numerical...

    Oh sorry, by 'order' I meant just numerical order. For example


    3 < 4 < 5 < 6
    should be true and

    3 < 5 < 4 < 6 should be false
  16. Replies
    7
    Views
    1,178

    easy way to check ordering of numbers?

    I want to check the ordering of numbers in an if statement, for example, in pseudo-code:


    if a < b < c < ... < z
    then do something magical
    else quit


    Is there an easy way to do this?...
  17. Replies
    2
    Views
    2,182

    Thanks, Yeah, the GUI needs to be part of the...

    Thanks,
    Yeah, the GUI needs to be part of the system. But I would still need event-driven programming even without the GUI.

    After reading some other threads, like...
  18. Replies
    2
    Views
    2,182

    how to organize an event driven system

    I'm look for advice or references to help me code a multi-layer event driven system.

    The software is broken up into several layers:
    The bottom layer is in an infinite loop. It takes input from a...
  19. Replies
    13
    Views
    3,734

    Great, thanks. I'll just switch them to pointers...

    Great, thanks. I'll just switch them to pointers and keep it simple for now.
  20. Replies
    13
    Views
    3,734

    Could someone remind me why this doesn't work? I...

    Could someone remind me why this doesn't work? I don't know much about constructors and such.



    typedef struct
    {
    int a;
    // etc... all primitive types
    } Blob;
  21. Replies
    13
    Views
    3,734

    Hmm... I've just realized that I need to add a...

    Hmm... I've just realized that I need to add a third parameter to each vector element - a double: the "score" of each pair. Then I want to sort the vector based on the score.
    Is there such a thing...
  22. Replies
    13
    Views
    3,734

    How would I use a reference? Do you mean in the...

    How would I use a reference? Do you mean in the parameters of the function?

    Would it be:

    void f ( std::vector<Blob> &blobsPtr )?

    And would calling the function be different? Right now I...
  23. Replies
    13
    Views
    3,734

    Well, std:: pair seemed to help out. Here's what...

    Well, std:: pair seemed to help out. Here's what I came up with, which seems to work.



    void filterPairwise(const IplImage *im, vector<Blob> *blobsPtr)
    {
    // create the vector to store every...
  24. Replies
    13
    Views
    3,734

    Cool, thanks. I'll look up std:: pair and hack...

    Cool, thanks. I'll look up std:: pair and hack around for a bit. That should simplify things.
  25. Replies
    13
    Views
    3,734

    vector of arrays of pointers to structures

    Hi,

    I have a function as below:



    void f ( std::vector<Blob> *blobsPtr )
    {
    // create the vector to store every pair of pointers to Blobs
    vector<Blob*[2]> pairs;
Results 1 to 25 of 46
Page 1 of 2 1 2