Search:

Type: Posts; User: aghast

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    4
    Views
    336

    That doesn't look like edge detection. It looks...

    That doesn't look like edge detection. It looks like reading the image from a file.

    Why not pull that out as a separate function, put in a main(), and go from there?
  2. You need to think about where in-line assembly...

    You need to think about where in-line assembly may appear.

    For example, if it appears inside a for loop:



    for (int i = 0; i < 10; ++i) {
    __asm__("movl %eax, %edx")
    }
  3. Replies
    5
    Views
    377

    Doing it the way you suggest is probably the...

    Doing it the way you suggest is probably the "right" way to do it, in terms of producing code that can be tested and debugged.

    However, it might produce "worse" code in objective terms. Many small...
  4. The storage classes are mutually exclusive. For...

    The storage classes are mutually exclusive. For example, static means "cannot be seen from outside" (among other things), while extern means "can be seen from outside." So having something be both...
  5. It might help if you really, really learn how C...

    It might help if you really, really learn how C declarations work.

    Consider this:


    int ary[3][5];


    In C, the rule is that type operators (pointer, array, function) are read postfix,...
  6. Replies
    6
    Views
    518

    Yes, parsing C programs is slow. There are really...

    Yes, parsing C programs is slow. There are really two reasons for parsing C. One is "compilation." This is the one everybody focuses on, but that's wrong. The second reason, which occurs far more...
  7. Replies
    5
    Views
    444

    The double pointer is one solution to programmer...

    The double pointer is one solution to programmer laziness. Here's the problem:



    struct Node {
    struct Node * next;
    ...
    };

    struct Node * Head;
  8. If you're transpiling to C, the output will be C...

    If you're transpiling to C, the output will be C code, no matter how complicated or awkwardly-written.

    However, as I pointed out, there are languages with features that you just cannot effectively...
  9. Thread: Beginner

    by aghast
    Replies
    5
    Views
    527

    Microsoft has problems with "staying inside the...

    Microsoft has problems with "staying inside the lines" when it comes to C. If you want to learn C++, MSVC is a great tool. If you want to learn C, I'd suggest you avoid MSVC until you have learned...
  10. It is not always possible to write a transpiler...

    It is not always possible to write a transpiler for a programming language. For example, dynamic languages such as Python or Lisp generally operate on a machine model that is not compatible with the...
  11. Replies
    3
    Views
    277

    What you are trying to build is a Singly Linked...

    What you are trying to build is a Singly Linked list. If you're asking this question, I strongly encourage you to read the Wikipedia article.

    Singly linked lists are not "the most important data...
  12. Replies
    10
    Views
    691

    Two things: john.c has shown you a great...

    Two things:



    john.c has shown you a great technique for simplifying almost all of your C code. If you are coding on Linux, you can make use of a library called libexplain. The same library...
  13. Replies
    3
    Views
    408

    Are you taking input from the user? Then the...

    Are you taking input from the user? Then the number is a string when you read it, and you have to somehow convert it to an int or float during the input process.

    Are you computing the number, or...
  14. Replies
    12
    Views
    794

    Like a lot of things, it's mainly from habit. ;-)...

    Like a lot of things, it's mainly from habit. ;-)

    I don't use variables (such as const uint8_t num_flexiforce_sensors = 8;) because they are variables, not constants. You cannot use a variable to...
  15. Replies
    3
    Views
    340

    Got any output?

    Got any output?
  16. Replies
    12
    Views
    794

    In function: saadc_sample(struct s_sampling...

    In function: saadc_sample(struct s_sampling *sampling)

    sampling->packet_counter;

    Remove this line, or change the code to support its use. It appears to do nothing, and I do not see any use of...
  17. Replies
    2
    Views
    415

    Break it down in small pieces. ...

    Break it down in small pieces.

    draw_rectangle(x, y)
    - draw ul corner
    - draw top line
    - draw ur corner
    - for loop
    - draw left side
    - draw right side
    - draw bl corner
  18. I don't fully understand your complaint, because...

    I don't fully understand your complaint, because your "error" example looks fine to me -- what should it be doing?

    Regardless, I think you are seeing the behavior that you are, because of the...
  19. Replies
    5
    Views
    610

    Remember that pointers in C have type...

    Remember that pointers in C have type information, but have no limits.

    That is, if I give you a pointer value, such as p = 0x12345678, and say "this is a pointer to struct Foo," you can access a...
  20. Replies
    4
    Views
    691

    I don't see any logic to ensure that the numbers...

    I don't see any logic to ensure that the numbers are in proper order. That is, you never check if a < b, or c < d, prior to doing your other checks. This would be validation and your course may not...
  21. Replies
    6
    Views
    597

    You say that one item is in the wrong place. Is...

    You say that one item is in the wrong place. Is that known? In other words, are you trying to solve a problem that guarantees that exactly one item is in the wrong place? Because that is different...
  22. Replies
    7
    Views
    790

    According to the standard, void * pointers are...

    According to the standard, void * pointers are "wide" enough (that is, they are made up of enough bits) to store any kind of pointer used by the system.

    There are, or have been in the past,...
  23. Replies
    25
    Views
    2,132

    Your print statement is commented out.

    Your print statement is commented out.
  24. Here's a hint: The problem statement...

    Here's a hint:

    The problem statement explicitly calls for column displays. And it appears to require the columns to correspond directly to the numbers entered. So you cannot reorder the numbers...
  25. Replies
    3
    Views
    758

    Create an array of const char * pointers into a...

    Create an array of const char * pointers into a single string. Each pointer must be distinct, but the set of pointers must also be compact.

    Use the _Generic() feature, with a macro, to implement...
Results 1 to 25 of 76
Page 1 of 4 1 2 3 4