Search:

Type: Posts; User: Salem

Page 1 of 20 1 2 3 4

Search: Search took 0.27 seconds; generated 7 minute(s) ago.

  1. Replies
    1
    Views
    818

    The first thing might be to fix all the...

    The first thing might be to fix all the compilation errors.
    It might look like C, but you need a C++ compiler to compile it.


    $ gcc -g bar.c
    bar.c: In function ‘successor’:
    bar.c:235:5: error:...
  2. > what if you want to write a compiler which is...

    > what if you want to write a compiler which is what I want to do?
    Have you actually read any books or courses on compiler construction?

    Just making it generate correct code will be achievement...
  3. First off, trying to time anything calling printf...

    First off, trying to time anything calling printf is a fools errand.
    You're trying to measure an ant-fart in a hurricane.

    Second, it's basically the same code whichever way you write it.
    ...
  4. Replies
    3
    Views
    285

    Well if you don't mess up the numbering with an...

    Well if you don't mess up the numbering with an assignment, you typically do this.


    typedef enum {EMPTY, RST, PWM_DIV, PWM_DUTYCYCLE, DAC_REF, ADC_SAMP_TIME, ADC_NUM_SAMPLES, ADC_CONV, CMD_LAST}...
  5. Replies
    9
    Views
    641

    > char sorted_key[strlen(key)]; This should be...

    > char sorted_key[strlen(key)];
    This should be
    char sorted_key[strlen(key)+1];

    You need the +1 for the \0 at the end of the string.
  6. Compile with the -c flag, then use the nm tool to...

    Compile with the -c flag, then use the nm tool to find out what the external names actually look like.


    $ g++ -c foo.cpp
    $ nm -u foo.o
    U __cxa_atexit
    U...
  7. Consider some refactoring of the code. ...

    Consider some refactoring of the code.



    #define B_MAX_ROWS 10
    #define B_MAX_COLS 10
    #define F_MAX_ROWS 10
    #define F_MAX_COLS 10

    double blade_d[B_MAX_ROWS][B_MAX_COLS];
  8. Replies
    1
    Views
    7,348

    > What does Linux programming mean to you? It...

    > What does Linux programming mean to you?
    It means your platform is Linux rather than Windows (or some other OS, or even no OS).

    Basically, it means referring to
    Linux manual pages: section 2...
  9. Replies
    2
    Views
    2,450

    My order, just based on a bit of reading. 3....

    My order, just based on a bit of reading.

    3. overloaded-virtual clang
    c++ overloaded virtual function warning by clang? - Stack Overflow
    It depends what the programmer was trying to achieve....
  10. Replies
    5
    Views
    2,897

    > in this code you hard coded the columns and...

    > in this code you hard coded the columns and rows when swapping.
    That's only to show you how it works.

    > How can I code it so that it does the calculations to this?
    Well where in the code do...
  11. Replies
    5
    Views
    2,897

    Study this -> A development process...

    Study this -> A development process

    Then this.


    #include <stdio.h>
    #include <string.h>

    // Use a fixed sized array to test with before
    // adding complications with variable sizes
  12. Write of size 4 at 0x7ffc9cf005cc by thread T3...

    Write of size 4 at 0x7ffc9cf005cc by thread T3 (mutexes: write M7):
    #0 calculate_map /mnt/nfs/homes/rpohlen/Documents/......../fractol_draw.c:93:18 (fractol+0x4b8ef6)


    Previous read of...
  13. > data->map is malloced but not zero filled. It's...

    > data->map is malloced but not zero filled. It's used over and over by threads and freed at the end of the program.
    I noticed your test code allocated


    data.map = malloc(WINX *...
  14. > This is a school assignment and for some reason...

    > This is a school assignment and for some reason at my school, for loops are forbidden.
    A lot of tutors seem to have a perverse delight in making students 'do x' without using the most rational...
  15. Replies
    5
    Views
    721

    Garbage at the start of the string is a sign that...

    Garbage at the start of the string is a sign that you're not initialising your dynamically allocated string properly.

    See my example.
  16. Replies
    1
    Views
    311

    Well if you have all the characters in a buffer,...

    Well if you have all the characters in a buffer, like

    char buff[] = "24A3\r";

    Then strtol, strtoll - cppreference.com
    long x = strtol(&buff[1], NULL, 16);
  17. Replies
    5
    Views
    721

    It would be helpful to see an example of a before...

    It would be helpful to see an example of a before and after.

    > char *censor(char *message, char *list)
    What is the output of
    censor("the cat sat on the mat","at cat mat");

    message and list...
  18. Well read_string isn't actually storing anything...

    Well read_string isn't actually storing anything in sentence.


    char read_string(char *fname, char *sentence){
    printf("Enter the filename:");
    scanf("%s",fname);

    FILE* ptr =...
  19. Replies
    2
    Views
    13,296

    Well saying _TEXT and L together is redundant....

    Well saying _TEXT and L together is redundant.
    The _TEXT macro automatically puts an L in the result when in UNICODE mode.

    Eg
    _TEXT("HelloMsg")

    I also had to save the source file as a UNICODE...
  20. Recall that a string constant has a type of...

    Recall that a string constant has a type of 'const char *'

    And all string constants will compare as not equal to NULL.
    A pointer in a boolean context is implied as comparing it with NULL.
    So in...
  21. Replies
    1
    Views
    274

    I'd say it rather more depends on which OS you're...

    I'd say it rather more depends on which OS you're targetting.

    What research have you done?
    block writing to usb at DuckDuckGo
  22. Where you would use for ( row for ( col to...

    Where you would use
    for ( row
    for ( col

    to print "HelloI"

    You would use
    for ( col
    for ( row
  23. So is it working then? If you want it to keep...

    So is it working then?

    If you want it to keep going, you shouldn't be doing this.
    finished = paComplete;
  24. Replies
    6
    Views
    1,533

    > Sorry, I meant to say with the = sign nothing...

    > Sorry, I meant to say with the = sign nothing compiles and get an error.
    What?

    Oh wait, you wrote this on your phone rather than copy/pasting it from your text editor.

    Come back when you're...
  25. > ((void(*)(void))code)(); Put a breakpoint...

    > ((void(*)(void))code)();
    Put a breakpoint here, then use the debugger to disassemble code to see if it's what you expected.

    Then maybe even single step it.
Results 1 to 25 of 492
Page 1 of 20 1 2 3 4