home.social

#pragma — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #pragma, aggregated by home.social.

  1. "It's like a doctor hearing a patient who says, 'My knee hurts,' who then delivers a lecture on the elegance of the musculoskeletal system. The patient doesn't need you to appreciate the beauty of human biology. They need you to look at their damn knee."

    #ai #humanity #pragma

    personfamiliar.com/p/ai-humani

  2. "It's like a doctor hearing a patient who says, 'My knee hurts,' who then delivers a lecture on the elegance of the musculoskeletal system. The patient doesn't need you to appreciate the beauty of human biology. They need you to look at their damn knee."

    #ai #humanity #pragma

    personfamiliar.com/p/ai-humani

  3. "It's like a doctor hearing a patient who says, 'My knee hurts,' who then delivers a lecture on the elegance of the musculoskeletal system. The patient doesn't need you to appreciate the beauty of human biology. They need you to look at their damn knee."

    personfamiliar.com/p/ai-humani

  4. "It's like a doctor hearing a patient who says, 'My knee hurts,' who then delivers a lecture on the elegance of the musculoskeletal system. The patient doesn't need you to appreciate the beauty of human biology. They need you to look at their damn knee."

    #ai #humanity #pragma

    personfamiliar.com/p/ai-humani

  5. "It's like a doctor hearing a patient who says, 'My knee hurts,' who then delivers a lecture on the elegance of the musculoskeletal system. The patient doesn't need you to appreciate the beauty of human biology. They need you to look at their damn knee."

    #ai #humanity #pragma

    personfamiliar.com/p/ai-humani

  6. @sjolsen @kirakira I'm pretty sure there's a for that somewhere

  7. @floooh @lritter @greenmoonmoon Yes, but that does not require #pragma pack at all. Just the explicit padding members are enough.

  8. @floooh @lritter @greenmoonmoon Yes, but that does not require #pragma pack at all. Just the explicit padding members are enough.

  9. @floooh @lritter @greenmoonmoon Yes, but that does not require #pragma pack at all. Just the explicit padding members are enough.

  10. @floooh @lritter @greenmoonmoon Yes, but that does not require #pragma pack at all. Just the explicit padding members are enough.

  11. @floooh @lritter @greenmoonmoon Yes, but that does not require #pragma pack at all. Just the explicit padding members are enough.

  12. @floooh @lritter @greenmoonmoon At that point, #pragma pack is kind of pointless, because it does nothing. You have already filled all the holes that packing would eliminate.
    If you want to model alignment that does not match the language alignment rules precisely (i.e. GPU, or file formats), I would strongly suggest doing what boost::endian does: Use distinct types that are naturally byte aligned (i.e. arrays of bytes), and (in C) accessor functions or (in C++) implicit conversions.

  13. @floooh @lritter @greenmoonmoon At that point, #pragma pack is kind of pointless, because it does nothing. You have already filled all the holes that packing would eliminate.
    If you want to model alignment that does not match the language alignment rules precisely (i.e. GPU, or file formats), I would strongly suggest doing what boost::endian does: Use distinct types that are naturally byte aligned (i.e. arrays of bytes), and (in C) accessor functions or (in C++) implicit conversions.

  14. @floooh @lritter @greenmoonmoon At that point, #pragma pack is kind of pointless, because it does nothing. You have already filled all the holes that packing would eliminate.
    If you want to model alignment that does not match the language alignment rules precisely (i.e. GPU, or file formats), I would strongly suggest doing what boost::endian does: Use distinct types that are naturally byte aligned (i.e. arrays of bytes), and (in C) accessor functions or (in C++) implicit conversions.

  15. @floooh @lritter @greenmoonmoon At that point, #pragma pack is kind of pointless, because it does nothing. You have already filled all the holes that packing would eliminate.
    If you want to model alignment that does not match the language alignment rules precisely (i.e. GPU, or file formats), I would strongly suggest doing what boost::endian does: Use distinct types that are naturally byte aligned (i.e. arrays of bytes), and (in C) accessor functions or (in C++) implicit conversions.

  16. @floooh @lritter @greenmoonmoon At that point, #pragma pack is kind of pointless, because it does nothing. You have already filled all the holes that packing would eliminate.
    If you want to model alignment that does not match the language alignment rules precisely (i.e. GPU, or file formats), I would strongly suggest doing what boost::endian does: Use distinct types that are naturally byte aligned (i.e. arrays of bytes), and (in C) accessor functions or (in C++) implicit conversions.

  17. @floooh @lritter @greenmoonmoon Packed structs are almost never "safe" in any way.
    As soon as you pass a reference or pointer to a packed and non-aligned member in that struct, you are in Undefined Behaviour land, because non-aligned objects must not exist, and the compiler will break that basically immediately. The non-alignedness is not encoded in the type system, neither for #pragma pack, nor for __attribute__((packed)).
    A simple call to std::min is enough to break things.

  18. @floooh @lritter @greenmoonmoon Packed structs are almost never "safe" in any way.
    As soon as you pass a reference or pointer to a packed and non-aligned member in that struct, you are in Undefined Behaviour land, because non-aligned objects must not exist, and the compiler will break that basically immediately. The non-alignedness is not encoded in the type system, neither for #pragma pack, nor for __attribute__((packed)).
    A simple call to std::min is enough to break things.

  19. @floooh @lritter @greenmoonmoon Packed structs are almost never "safe" in any way.
    As soon as you pass a reference or pointer to a packed and non-aligned member in that struct, you are in Undefined Behaviour land, because non-aligned objects must not exist, and the compiler will break that basically immediately. The non-alignedness is not encoded in the type system, neither for #pragma pack, nor for __attribute__((packed)).
    A simple call to std::min is enough to break things.

  20. @floooh @lritter @greenmoonmoon Packed structs are almost never "safe" in any way.
    As soon as you pass a reference or pointer to a packed and non-aligned member in that struct, you are in Undefined Behaviour land, because non-aligned objects must not exist, and the compiler will break that basically immediately. The non-alignedness is not encoded in the type system, neither for #pragma pack, nor for __attribute__((packed)).
    A simple call to std::min is enough to break things.

  21. @floooh @lritter @greenmoonmoon Packed structs are almost never "safe" in any way.
    As soon as you pass a reference or pointer to a packed and non-aligned member in that struct, you are in Undefined Behaviour land, because non-aligned objects must not exist, and the compiler will break that basically immediately. The non-alignedness is not encoded in the type system, neither for #pragma pack, nor for __attribute__((packed)).
    A simple call to std::min is enough to break things.

  22. @floooh @lritter @greenmoonmoon Yeah, surrounding the structs you want this on with:

    #pragma pack(push, 1)

    // structs

    #pragma pack(pop)

    That's right, right? Been a while since I learnt about that.

  23. @floooh @lritter @greenmoonmoon Yeah, surrounding the structs you want this on with:

    #pragma pack(push, 1)

    // structs

    #pragma pack(pop)

    That's right, right? Been a while since I learnt about that.

  24. @floooh @lritter @greenmoonmoon Yeah, surrounding the structs you want this on with:

    #pragma pack(push, 1)

    // structs

    #pragma pack(pop)

    That's right, right? Been a while since I learnt about that.

  25. @floooh @lritter @greenmoonmoon Yeah, surrounding the structs you want this on with:

    pack(push, 1)

    // structs

    pack(pop)

    That's right, right? Been a while since I learnt about that.

  26. @floooh @lritter @greenmoonmoon Yeah, surrounding the structs you want this on with:

    #pragma pack(push, 1)

    // structs

    #pragma pack(pop)

    That's right, right? Been a while since I learnt about that.

  27. @Lapizistik #PRAGMA DO_WHAT_I_MEAN

    Funktioniert bei mir schon seit Jahren 😂

  28. @Lapizistik #PRAGMA DO_WHAT_I_MEAN

    Funktioniert bei mir schon seit Jahren 😂

  29. @Lapizistik #PRAGMA DO_WHAT_I_MEAN

    Funktioniert bei mir schon seit Jahren 😂

  30. @funkylab I agree with you about the semantics around if directives in this particular example. The unclear part is the definition of what “#pragma once” actually does. You could argue that in the second processing of the file, when it sees the pragma, it knows that the file is already being processed lower in the file stack. So you could reason: maybe it should abort the processing and assume the file had been processed.

  31. @funkylab I agree with you about the semantics around if directives in this particular example. The unclear part is the definition of what “#pragma once” actually does. You could argue that in the second processing of the file, when it sees the pragma, it knows that the file is already being processed lower in the file stack. So you could reason: maybe it should abort the processing and assume the file had been processed.

  32. @funkylab I agree with you about the semantics around if directives in this particular example. The unclear part is the definition of what “#pragma once” actually does. You could argue that in the second processing of the file, when it sees the pragma, it knows that the file is already being processed lower in the file stack. So you could reason: maybe it should abort the processing and assume the file had been processed.

  33. @funkylab I agree with you about the semantics around if directives in this particular example. The unclear part is the definition of what “#pragma once” actually does. You could argue that in the second processing of the file, when it sees the pragma, it knows that the file is already being processed lower in the file stack. So you could reason: maybe it should abort the processing and assume the file had been processed.

  34. @funkylab I agree with you about the semantics around if directives in this particular example. The unclear part is the definition of what “#pragma once” actually does. You could argue that in the second processing of the file, when it sees the pragma, it knows that the file is already being processed lower in the file stack. So you could reason: maybe it should abort the processing and assume the file had been processed.

  35. @funkylab it’s really to do with it not being standardised more than anything else. Like what is the expectation of preprocessing the following file lol.h

    #ifndef foo
    #define foo
    #else
    #pragma once
    #endif
    #include "lol.h"
    Yo

    Is it a single “Yo” or two lines of “Yo”?

    If it was defined that it needed to be the first thing in a file following whitespace, I think i’f be fine with it.

  36. @funkylab it’s really to do with it not being standardised more than anything else. Like what is the expectation of preprocessing the following file lol.h

    #ifndef foo
    #define foo
    #else
    #pragma once
    #endif
    #include "lol.h"
    Yo

    Is it a single “Yo” or two lines of “Yo”?

    If it was defined that it needed to be the first thing in a file following whitespace, I think i’f be fine with it.

  37. @funkylab it’s really to do with it not being standardised more than anything else. Like what is the expectation of preprocessing the following file lol.h

    #ifndef foo
    #define foo
    #else
    #pragma once
    #endif
    #include "lol.h"
    Yo

    Is it a single “Yo” or two lines of “Yo”?

    If it was defined that it needed to be the first thing in a file following whitespace, I think i’f be fine with it.

  38. @funkylab it’s really to do with it not being standardised more than anything else. Like what is the expectation of preprocessing the following file lol.h

    #ifndef foo
    #define foo
    #else
    #pragma once
    #endif
    #include "lol.h"
    Yo

    Is it a single “Yo” or two lines of “Yo”?

    If it was defined that it needed to be the first thing in a file following whitespace, I think i’f be fine with it.

  39. @funkylab it’s really to do with it not being standardised more than anything else. Like what is the expectation of preprocessing the following file lol.h

    #ifndef foo
    #define foo
    #else
    #pragma once
    #endif
    #include "lol.h"
    Yo

    Is it a single “Yo” or two lines of “Yo”?

    If it was defined that it needed to be the first thing in a file following whitespace, I think i’f be fine with it.

  40. I’m writing a C preprocessor (don’t even ask) and it’s horrible. I literally have the c90 and c99 specs in front of me and still keep using clang to preprocess code snippets to see what it does with edge cases. The whole thing has vibes of “write a formal spec that describes this exact awful C program using 50x as much english text as code in the program”. Also “#pragma once” is awful.

  41. I’m writing a C preprocessor (don’t even ask) and it’s horrible. I literally have the c90 and c99 specs in front of me and still keep using clang to preprocess code snippets to see what it does with edge cases. The whole thing has vibes of “write a formal spec that describes this exact awful C program using 50x as much english text as code in the program”. Also “#pragma once” is awful.

  42. I’m writing a C preprocessor (don’t even ask) and it’s horrible. I literally have the c90 and c99 specs in front of me and still keep using clang to preprocess code snippets to see what it does with edge cases. The whole thing has vibes of “write a formal spec that describes this exact awful C program using 50x as much english text as code in the program”. Also “#pragma once” is awful.

  43. I’m writing a C preprocessor (don’t even ask) and it’s horrible. I literally have the c90 and c99 specs in front of me and still keep using clang to preprocess code snippets to see what it does with edge cases. The whole thing has vibes of “write a formal spec that describes this exact awful C program using 50x as much english text as code in the program”. Also “#pragma once” is awful.