home.social

#pragma — Public Fediverse posts

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

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

  2. @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.

  3. @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.

  4. @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.

  5. @Lapizistik #PRAGMA DO_WHAT_I_MEAN

    Funktioniert bei mir schon seit Jahren 😂

  6. @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.

  7. @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.

  8. @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.

  9. @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.

  10. @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.

  11. @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.

  12. 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.

  13. @[email protected] @[email protected] to be clear we're talking about proper include guards that are like

    #ifndef HEADER_H
    #define HEADER_H
    
    #endif

    not the other type of guard that's
    #ifndef HEADER_H
    #include "header.h"
    #define HEADER_H
    #endif
    ?

    I am not sure that there is a compiler that'd optimize that out because i feel like there's a difference in defining via preprocessor and
    #pragma once. Anyway, the reason I've always heard is that doing it old school hurts performance because it performs multiple checks on that instead of a single pass. In theory, the second is better

  14. Line of code I just wrote:

    #pragma warning disable CA1822 // Is this the stupidest analyzer rule? It's definitely in contention.

    #DotNet

  15. TopSpeed compiler fact: Project files (like a makefile) don't care about line breaks. So this:

    #system epoc img
    #set epocinit=iplib
    #model small jpi

    #pragma debug(vid=>full)
    #compile %main
    #link %prjname

    is the same as this:

    #system epoc img #set epocinit=iplib #model small jpi #pragma debug(vid=>full) #compile %main #link %prjname

    I learned this today.

    I am not sidequesting.

  16. @AmenZwa @dougmerritt I checked: I used "pragma" once in 1990. In fact, the actual line is "#pragma once"! I never commented it, so I have no idea why it was there or what it was supposed to do.

  17. why do they call it the "2008 anime convention" and not #pragma glomp parallel

  18. @mort Yeah, this is tricky... =/

    The best approach I know of still isn't portable across compilers -- Clang's `#pragma clang loop`: clang.llvm.org/docs/LanguageEx

  19. @jrose However, despite the automated tests, if someone had responded to my post with "uhh yo win32 has 3 bytes padding between each bool" it would have saved me a little bit of time.

    someone else pointed there's no *downside* to just tossing #pragma pack in there, so i did.

  20. @Merc @kirby or #pragma omp parallel it instead

    people pick the wrong concurrency problem for their solution and wonder why it sucks
  21. "We don't need to do it this quarter just because some startup has to do an earnings call. We will do it if it helps us."

    #ai #pragma

    gpt3experiments.substack.com/p

  22. @gfaster Apparently early GCC used to exec into nethack when encountering a #pragma in any source file, as a joke (since #pragma was at the time technically undefined behavior, and GCC didn't support any at the time)

  23. C/C++のインクルードガード、どっち派? (どちらも選べる状況として)

  24. @ayba to avoid features creep, I would say. We don't need `#pragma once`, because `#ifndef` already solves that problem. Keeping things simple (in the scientific sense of "composed of fewer elements") is the spirit of C. There are already many other languages that provide tons of features and many different ways to do the same thing, I'm glad C sticks to its specificity.

  25. How to politely use assert in a header (gcc/clang/msvc/what else?):

    #pragma push_macro("NDEBUG")
    #undef NDEBUG
    #include <assert.h>
    // your asserts should properly assert
    #pragma pop_macro("NDEBUG")
    // nobody has 2 know

    Your vendor’s assert.h should be able to be included multiple times with NDEBUG defined or not.

  26. Interpreter and Interpretant • Discussion 1
    inquiryintoinquiry.com/2024/02

    Re: Conceptual Graphs
    lists.cs.uni-kassel.de/hyperki

    Helmut Raulien:
    ❝I find it a bit problematic to say, that the sign determines the interpretant, because the sign doesn't infer, it is the interpreter, who does the inference. But ok, I guess we might say, that Peirce prescinds the semiosis from the interpreter, so, ok, the flow of determination goes from the sign to the interpretant, because it is the interpreter, who receives the sign, and then forms the interpretant […]❞

    Helmut,

    Thanks for this. Something about the way you expressed the question led me to think of a new angle on it.

    What makes an interpretant is fairly simple, at least, here's the catch, once you have the appropriate mathematical framework in place — An interpretant is whatever appears in the third place of a sign‑relational triple (o, s, i).

    What makes an interpreter is more complex. I'll take that up as I get more time.

    Resources —

    Pragmatic Maxim
    inquiryintoinquiry.com/2023/08

    Hypostatic Abstraction
    inquiryintoinquiry.com/2008/08

    #Peirce #Logic #Semiotics #SignRelations #TriadicRelations
    #Inference #Information #Inquiry #Interpreter #Interpretant
    #Abstraction #HypostaticAbstraction #PrescissiveAbstraction
    #Pragma #Pragmata #Pragmatism #PragmaticMaxim #Determination

  27. Interpreter and Interpretant • Selection 2
    inquiryintoinquiry.com/2024/01

    In the next passage up for review the hypostatic abstraction of a person to conduct the movement of signs is described by Peirce as a Sop to Cerberus, a rhetorical gambit set to side‑step a persistent difficulty of exposition.

    ❝It is clearly indispensable to start with an accurate and broad analysis of the nature of a Sign. I define a Sign as anything which is so determined by something else, called its Object, and so determines an effect upon a person, which effect I call its Interpretant, that the latter is thereby mediately determined by the former. My insertion of “upon a person” is a sop to Cerberus, because I despair of making my own broader conception understood.❞ (Peirce 1908, Selected Writings, p. 404).

    Reference —

    Peirce, C.S. (1908), “Letters to Lady Welby”, Chapter 24, pp. 380–432 in Charles S. Peirce : Selected Writings (Values in a Universe of Chance), Edited with Introduction and Notes by Philip P. Wiener, Dover Publications, New York, NY, 1966.

    Resource —

    Hypostatic Abstraction
    inquiryintoinquiry.com/2008/08

    #Peirce #Logic #Semiotics #SignRelations #TriadicRelations
    #Aristotle #Interpretation #Hermeneutics #InterpretantSign
    #Abstraction #HypostaticAbstraction #SopToCerberus #Pragma

  28. Differential Propositional Calculus • Discussion 9
    inquiryintoinquiry.com/2024/01

    ❝Consider what effects that might conceivably have
    practical bearings you conceive the objects of your
    conception to have. Then, your conception of those
    effects is the whole of your conception of the object.❞

    — C.S. Peirce • The Maxim of Pragmatism

    Re: Facebook Discussion
    facebook.com/JonnyCache/posts/

    Re: Tim Browning
    facebook.com/JonnyCache/posts/

    Tim Browning wrote:
    Makes me wonder if all that is the case, i.e. the universe, is the existence of objects (materialism) or information (idealism).

    “Objects of your conception” seems to imply a transcendent perspective that can distinguish between concept and object. Am I overthinking this?
    [end quote]

    Hi Tim,

    It helps to read “object” in a fuller sense than we often do in billiard‑ball philosophies, as a lot gets lost in the translation from the Greek “pragma” from which pragmatism naturally takes it cue. For a sample of that fuller sense see the following lexicon entry.

    πρᾶγμα • Liddell, H.G., and Scott, R. (1925), A Greek-English Lexicon (1940 edition)
    perseus.tufts.edu/hopper/text?

    Perseus Digital Library
    perseus.tufts.edu/hopper/

    Resources —

    Pragmatic Maxim
    inquiryintoinquiry.com/2008/08

    Differential Logic and Dynamic Systems
    oeis.org/wiki/Differential_Log

    Differential Logic • Analytic Expansions
    oeis.org/wiki/Differential_Log

    #Peirce #Logic #LogicalGraphs #DifferentialLogic #DiscreteDynamicalSystems
    #BooleanFunctions #BooleanDifferenceCalculus #CalculusOfLogicalDifferences
    #PropositionalCalculus #DifferentialPropositionalCalculus #LogicalDynamics
    #Pragma #Pragmata #PragmaticMaxim #PracticalBearings #ConceptionOfEffects

  29. In the Way of Inquiry • Objections to Reflexive Inquiry 2
    inquiryintoinquiry.com/2023/02

    Our agent of inquiry is brought to the threshold of two questions:

    • What actions are available to achieve the aims of the present activity?

    • What assumptions already accepted are advisable to amend or abandon?

    The inquirer is faced in the object of inquiry with an obstinately oppositional state of affairs, a character marked by the Greek word “pragma” for “object”, whose manifold of senses and derivatives includes among its connotations the ideas of purposeful objectives and problematic objections, and not too incidentally both inquiries and expositions.

    Overview
    oeis.org/wiki/Inquiry_Driven_S

    Obstacles
    oeis.org/wiki/Inquiry_Driven_S

    #Peirce #Inquiry #InquiryIntoInquiry #InquiryDrivenSystems
    #Anomaly #Doubt #Discrepancy #Dispersion #Entropy #Uncertainty
    #Interruption #Obstruction #Information #Comprehension #Extension
    #Pragma #Pragmata #Purpose #Objective #Problem #Objection #Praxis
    #Semiotics #SignRelations #Semiositis #Reflection #SelfApplication