Skip to main content
Code Review

Return to Answer

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

A few comments on the code posted in the question (hopefully not conflicting with @ferada @ferada):

A few comments on the code posted in the question (hopefully not conflicting with @ferada):

A few comments on the code posted in the question (hopefully not conflicting with @ferada):

added 262 characters in body
Source Link
syb0rg
  • 21.9k
  • 10
  • 113
  • 192

The problem for my project to compile was that I couldn't guarantee that. I also didn't want the user scrounging around trying to figure out how to get my application to simply compile. Here's what I did, I used CMake to handle all of that. It took a bit of work, but here's the jist of what it does: it takes all of the dependencies that youyour application relies on and searches the host computer for them. If it finds them, it stores that location for it's use later when compiling. If it can't find them, then it manually downloads them and performs it's own build of the dependency which it will then use later for compiling. A The real "fun" part comes in where you dependency has sub-dependencies, which I also had to deal with...

It's a lot more work, but also a whole lot more portable and less stressful for the end user (which should be the ultimate goal really for all developers, making the usage of your application as hassle-free as possible for your consumers).

enter image description hereenter image description here

The problem for my project to compile was that I couldn't guarantee that. I also didn't want the user scrounging around trying to figure out how to get my application to simply compile. Here's what I did, I used CMake to handle all of that. It took a bit of work, but here's the jist of what it does: it takes all of the dependencies that you application relies on and searches the host computer for them. If it finds them, it stores that location for it's use later when compiling. If it can't find them, then it manually downloads them and performs it's own build of the dependency which it will then use later for compiling. A lot more work, but also a whole lot more portable and less stressful for the end user.

enter image description here

The problem for my project to compile was that I couldn't guarantee that. I also didn't want the user scrounging around trying to figure out how to get my application to simply compile. Here's what I did, I used CMake to handle all of that. It took a bit of work, but here's the jist of what it does: it takes all of the dependencies that your application relies on and searches the host computer for them. If it finds them, it stores that location for it's use later when compiling. If it can't find them, then it manually downloads them and performs it's own build of the dependency which it will then use later for compiling. The real "fun" part comes in where you dependency has sub-dependencies, which I also had to deal with...

It's a lot more work, but also a whole lot more portable and less stressful for the end user (which should be the ultimate goal really for all developers, making the usage of your application as hassle-free as possible for your consumers).

enter image description here

added 122 characters in body
Source Link
syb0rg
  • 21.9k
  • 10
  • 113
  • 192
  • I notice some suspiciously similar code in a few places:

     if (error_code > 0) {
     fprintf(stderr, "I/O errors found while reading input.\n");
     hoedown_buffer_free(ib);
     fclose(in);
     exit(error_code);
     }
    

    The stuff within the conditional could be extracted to a function so that reuse would be possible, and would help your code follow the DRY principles. This should also shorten your code a bit

  • You should be declaring your counter variable (int i in this case, within your for loops), so that it is in the smallest scope possible.(C99)

  • You don't have to memset your char arrays to 0, just initialize them that way.

     char nameBuff[23] = "";
    

Or the more "universal" way to zero out an array (since it works with every type):

 char nameBuff[23] = {};
  • Nice job generating a temporary file safely! I have one big problem with it though, and it has to do with this line

    Nice job generating a temporary file safely! I have one big problem with it though, and it has to do with this line
  • I notice some suspiciously similar code in a few places:

     if (error_code > 0) {
     fprintf(stderr, "I/O errors found while reading input.\n");
     hoedown_buffer_free(ib);
     fclose(in);
     exit(error_code);
     }
    

    The stuff within the conditional could be extracted to a function so that reuse would be possible, and would help your code follow the DRY principles. This should also shorten your code a bit

  • You should be declaring your counter variable (int i in this case, within your for loops), so that it is in the smallest scope possible.(C99)

  • You don't have to memset your char arrays to 0, just initialize them that way.

     char nameBuff[23] = "";
    
  • Nice job generating a temporary file safely! I have one big problem with it though, and it has to do with this line

  • I notice some suspiciously similar code in a few places:

     if (error_code > 0) {
     fprintf(stderr, "I/O errors found while reading input.\n");
     hoedown_buffer_free(ib);
     fclose(in);
     exit(error_code);
     }
    

    The stuff within the conditional could be extracted to a function so that reuse would be possible, and would help your code follow the DRY principles. This should also shorten your code a bit

  • You should be declaring your counter variable (int i in this case, within your for loops), so that it is in the smallest scope possible.(C99)

  • You don't have to memset your char arrays to 0, just initialize them that way.

     char nameBuff[23] = "";
    

Or the more "universal" way to zero out an array (since it works with every type):

 char nameBuff[23] = {};
  • Nice job generating a temporary file safely! I have one big problem with it though, and it has to do with this line
added 9 characters in body
Source Link
syb0rg
  • 21.9k
  • 10
  • 113
  • 192
Loading
added 1 character in body
Source Link
syb0rg
  • 21.9k
  • 10
  • 113
  • 192
Loading
added 275 characters in body
Source Link
syb0rg
  • 21.9k
  • 10
  • 113
  • 192
Loading
Source Link
syb0rg
  • 21.9k
  • 10
  • 113
  • 192
Loading
lang-c

AltStyle によって変換されたページ (->オリジナル) /