• structuralize_this [none/use name]
    ·
    edit-2
    2 years ago

    Have it print some compiler flags.

    // Environment info
    fprintf (stdout,  "file: %s, line:\n %d; c++: %d | date: %s", __FILE__, __LINE__, __cplusplus, __DATE__);
    
    // gcc version
    fprintf (stdout,  "v%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
    
    • edge [he/him]
      hexagon
      ·
      edit-2
      2 years ago

      I only did the environment info, but here it is:

      file: flags.c, line:
       4; c++: 201103L | date: Feb  6 2023
      
        • edge [he/him]
          hexagon
          ·
          edit-2
          2 years ago

          Did it again with the gcc version, got this:

          file: flags.c, line:
           11; c++: 201402L | date: Feb  6 2023
          v8.4.0
          

          A different C++ version this time, idk if the gcc version matches.

          • structuralize_this [none/use name]
            ·
            2 years ago

            It shouldn't print the L. In 8.4.0, the the __cplusplus version is:

            c++: 201402
            

            But it also should be done in just raw dawg c mode so __cplusplus shouldn't be set and should fail to compile.

      • structuralize_this [none/use name]
        ·
        2 years ago

        the flags.c is interesting. did you specify that file? or is that being conjured as the "best fit" file from it's neuron soup?

        • edge [he/him]
          hexagon
          ·
          edit-2
          2 years ago

          I named it that. I did echo "...code here..." > flags.c

          Side note: at one point I tried to get it to do vim so I don't have to echo into a file like that, but it couldn't handle that. It would probably have been a worse experience anyway tbh.