Search:

Type: Posts; User: wiqxlzxsxj

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Yes that is what I was trying to do. Thanks!...

    Yes that is what I was trying to do. Thanks!
    Though I also managed to work it out using two mallocs for the list and then calling realloc on list->data alone.



    List *list = malloc(sizeof...
  2. Well, just realized that the static size_t vars...

    Well, just realized that the static size_t vars in the struct are anchoring the struct down from dynamic reallocation. The allocation occurs but then it overflows its neighbors as a result thus...
  3. If I add elements to the block before that...

    If I add elements to the block before that realloc, memcpy works fine.
  4. Elastic array block with malloc realloc

    I'm trying to implement a dynamic array using a struct:



    typedef struct
    {
    size_t count, el_size, alloc_count;
    void *data;
    } List;
  5. The problem was clearly outlined in the first...

    The problem was clearly outlined in the first post.
    qsort() sorts array, arrays of structs, but it won't sort "anything". For example lists. Instead of trying to fudge this problem I implemented my...
  6. With all due respect I am not your apprentice. If...

    With all due respect I am not your apprentice. If you consider yourself to be in a teaching position then all you've done is to suggest workarounds to the original problem. This isn't an exercise to...
  7. How is this at all related to the original...

    How is this at all related to the original question? You could work around to fit in qsort(). But that isn't the priority here!
  8. There is plenty of evidence of retardation in...

    There is plenty of evidence of retardation in this thread already.
  9. qsort is part of the C std. lib. It doesn't use...

    qsort is part of the C std. lib.
    It doesn't use malloc(). It uses a similar type approach I described above.
    I would prefer to reuse a pre-existing library if I could. But I am not using qsort...
  10. For an embedded application (or for any...

    For an embedded application (or for any application for that matter) you have to make predetermined assumptions about variable sizes. For example fixed char sizes to store strings etc, which my...
  11. Point is, I want to leave scratch as arbitrary...

    Point is, I want to leave scratch as arbitrary storage variable instead of assuming to cast it as data from the outset.
  12. Storing data in an arbitrarily large data type on the stack

    I have a struct of doubles like so:


    struct data
    {
    double x;
    double y;
    double z;
    } data;
  13. OK that's a fair enough explanation I was looking...

    OK that's a fair enough explanation I was looking for. In terms of the assembly instructions, an int will always be an int.
  14. I am asking if printf will segfault? But by...

    I am asking if printf will segfault? But by atomic I am referring to atomicity of a given operation in each mutually exclusive thread. So if X is being changed in the other thread and at the same,...
  15. I have already debugged the problem and the...

    I have already debugged the problem and the problem lies somewhere in the ncurses (wprintw) implementation that I have done. Basically there are variables being updated in another thread and the...
  16. Printing variables safely using printf, wprintw

    I was interested to know if there is any process already in place to check variables when printing them using printf or wprintw.

    Here is the scenario. There are variables being changed and altered...
  17. Replies
    2
    Views
    772

    OK thanks for this explanation. The key was to...

    OK thanks for this explanation. The key was to abstract the data pointer to another level up so that it could be used for more than one type of list data structure. This is what I was after. Namely a...
  18. Replies
    2
    Views
    772

    Generic Pointer Arithmetic

    I'm trying to implement a generic function pointer which does basic arithmetic (basic linked-list traversal) using a type based on the argument that the function received.

    So to reverse position...
  19. Replies
    0
    Views
    616

    Handling streaming data with libcurl

    I wish to handle incoming streaming data. Say through Twitter API. I am using libcurl and I have implemented the libcurl library usage correctly. The API is sending continuous stream of data...
  20. Single thread would be simpler and very easy to...

    Single thread would be simpler and very easy to implement. Only thing is with multithreading you can work on different parts of the data at the same time. If the data is very large then this might be...
  21. How can I set a FD based on a change of variable?

    How can I set a FD based on a change of variable?
  22. The overall function of the program is to get...

    The overall function of the program is to get data from the internet, process that data and then to format the data on the terminal. It's too large to post here. But as I am interested in low latency...
  23. There is no user interaction. var is changed...

    There is no user interaction.

    var is changed concurrently from another thread which is also running.
  24. Yoou're right, this is probably what I need....

    Yoou're right, this is probably what I need. There is no other way but to use a timeout up to some condition of a file descriptor. I also tried using a semaphore but it would seem one way or another...
  25. Thanks for this description Mario. i appreciate...

    Thanks for this description Mario. i appreciate the effort in clarifying the identity of a loop.

    OK.. so considering a while(1) loop, I've inserted a series of functions inside the loop so that...
Results 1 to 25 of 35
Page 1 of 2 1 2