Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

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

  1. Replies
    6
    Views
    409

    My policy: In case of doubt, DRAW! 16473

    My policy: In case of doubt, DRAW!

    16473
  2. Replies
    11
    Views
    987

    I suppose that these "sensors" are lasers which...

    I suppose that these "sensors" are lasers which have the beam interrupted by the object... But this isn't a good project and something is missing... with 6 pilars you should have 5 sensors:


    ->...
  3. Replies
    11
    Views
    987

    Let say your sensors are connected to bits 0 to 2...

    Let say your sensors are connected to bits 0 to 2 of a register called IR:

    // Do something... (here I'll pass sensors data to the functions).
    extern void not_in_weightbridge(unsigned int);...
  4. Replies
    6
    Views
    445

    "C only knows about binary at the machine level"...

    "C only knows about binary at the machine level" means: There is no "decimal format"!
  5. Replies
    5
    Views
    7,762

    Use 'statvfs' syscall.

    Use 'statvfs' syscall.
  6. And, clock() doesn't measure cpu clock cycles.

    And, clock() doesn't measure cpu clock cycles.
  7. Let me understand this: You want to do a GUI...

    Let me understand this: You want to do a GUI application for a keyboard because you want to use the mouse instead of pressing keys?
  8. AND... local objects aren't initialized to zero...

    AND... local objects aren't initialized to zero by default... Only static local objects OR global objects... This:


    int a[10]; // local
    Isn't initialized... This:


    int a[10] = { 0 }; ...
  9. And, NO... this: int f( ... ) { int b = 0;...

    And, NO... this:

    int f( ... )
    {
    int b = 0;
    ...
    }
    Here b is initialized at RUNTIME because it is on stack OR in a register...
    The compiler can discard this object only if the...
  10. I don't get where you are trying to reach......

    I don't get where you are trying to reach... this:

    int f( ... )
    {
    int a[10];
    int n;

    n = g( a );
    if ( ! n )
    return 0;
  11. Replies
    8
    Views
    1,078

    Yep, but it is nice to know that multi byte...

    Yep, but it is nice to know that multi byte charsets can be traced back to Dennis Ritchie and Ken Thompson in the 70's (UNICODE was designed based on experiences made by XEROX in the 80's -- as...
  12. Replies
    8
    Views
    1,078

    There are routines in wchar.h to convert to/from...

    There are routines in wchar.h to convert to/from wchar_t to/from local charset, but you have to set locale properly, typically:


    setlocale( LC_ALL, "" );
  13. Replies
    8
    Views
    1,078

    Well... working with single byte charsets isn't a...

    Well... working with single byte charsets isn't a real problem with portability... nowadays we have a difficult one: In Windows you can work with WINDOWS-1252 charset (a modified ISO-88591-1 charset)...
  14. A small correction: void...

    A small correction:



    void voltage(t_SenseDataRaw *k, float *adv) {
    uint16_t *p = &k->Vbias; // the first member (A pointer!).
    for (int i = 0; i < 4; i++)
    adv[i] = p[i] * 3.3...
  15. Simplier: // Circular single linked list...

    Simplier:



    // Circular single linked list test.

    #include <stdio.h>
    #include <stdlib.h>

    // Macro to initialize a list.
  16. Replies
    5
    Views
    966

    AND... free works (do nothing) if the pointer is...

    AND... free works (do nothing) if the pointer is NULL (ISO 9899 7.20.3.2 2)... But if the pointer isn't NULL and not allocated by the functions above, then the behavior is unspecified (probably a...
  17. Ahhh... yep, I'm talking about x86! x86 uses...

    Ahhh... yep, I'm talking about x86!

    x86 uses the static approach for conditional jumps because they are, mostly, used in loops. And with static behavior it is easy to avoid mispredictions: "if"...
  18. This is talking about "dynamic predictors", not...

    This is talking about "dynamic predictors", not static ones... Instructions as Jcc use "static" branch preditor algorithms. Only indirect jumps use dynamic...
  19. hamster_nz, what you described is valid for...

    hamster_nz, what you described is valid for indirect jumps. For conditional jumps the algorithm is simplier: forward jumps are assumed as NOT taken and backward jumps are assumed as taken.
  20. It helps if you paid attention... The forward...

    It helps if you paid attention... The forward jump (with penalty if taken) is made inverting the condition:


    if ( x < 100 ) f();

    ...
    cmp eax,100
    jge .skip ; JUMPS IF GREATER OR EQUAL...
  21. Replies
    8
    Views
    1,169

    It is good to remember that "signal" on integer...

    It is good to remember that "signal" on integer types are just semantic.


    // with sizeof(int)=4.
    int x = -1;
    unsigned int y == 0xffffffff;
    At binary level, both values are the same if two's...
  22. Yep, I know, I know... the compiler can use...

    Yep, I know, I know... the compiler can use cmovcc instruction to avoid conditional jumps...
  23. It depends... if x < 100 happens most of the time...

    It depends... if x < 100 happens most of the time this code is faster than if doesn't happen most of the time...


    if ( x < 100 )
    return x;
    return 100;
    Will loosely be compiled as

    #...
  24. Maybe some comments would help: .section ...

    Maybe some comments would help:

    .section .rodata

    .LC0:
    .string "%d"
    .LC1:
    .string "val is bigger than val2!"
    .LC2:
    .string "val is smaller than val2!"
  25. The reason why compilers like GCC and CLANG (I...

    The reason why compilers like GCC and CLANG (I don't deal with MSVC. It is a ........ty compiler) chooses to do conditional jumps forward to ELSE block is because it is assumed the THEN block will...
Results 1 to 25 of 497
Page 1 of 20 1 2 3 4