home.social

#defines — Public Fediverse posts

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

  1. @kevingranade i skipped the windows override injection stuff and just built the files alongside and used #defines to call the mi_malloc instead, worked great first try!

  2. @tedmielczarek Unfortunately, Windows.h #defines "near" and "far", and X11.h #defines "Success" and "Status", and both these files will eventually get indirectly included into every file.

  3. why did i think that i just needed need a couple of #defines in order to use the #RStats Matrix package's #cholmod headers github.com/cran/Matrix/blob/ma (and Matrix.so) to compile the bcftools PGS plugin github.com/freeseek/score/blob ? It worked on gcc, but clang (with defaults) was much less forgiving :D
    #RStats gurus : is their a #RStats package that just provides cholmod and nothing else ?

  4. @ljs @amonakov @pkhuong @thesamesam OK but let's go back to the more verbose way.

    #define __alloc_pages_node(...) alloc_hooks(__alloc_pages_node(__VA_ARGS__))
    #define __alloc_pages_node_noprof (__alloc_pages_node)

    Would that work then? Yes it's more (up to twice) #defines than we have now, but it wouldn't require us to rename the underlying functions to _noprof (and having see those _noprof symbols in perf, backtraces etc.).

  5. @celestia

    "Hey Bjarne, why don't we add this object oriented stuff to C? Classes are basically structs, right?

    "Well, the core of object orientation is the use of immutable messages, I don't see how that would work in C."

    "Just ignore that part then. Two or three #defines and we should be done."

    "I guess we need another bottle of wine."

  6. @ulexus In a strongly typed language a good IDE can do a great job on syntax - especially in a large project. But on a small C project with any significant #defines - it is pretty much a lost cause IMHO. Perhaps I haven't invested enough in configuration.

  7. @peteri That sounds like a strong possibility. All of the vga code is isolated in the vgadisplay.c file, and the resolution/mode is currently hardcoded in the #defines at the top of the file.

  8. I'm reminded of years ago when I discovered that the Illumos driver for 10G-T Intel Ethernet chipsets had a 'wait' operation that was implemented with a busy-wait, and used it for multi-millisecond waits through a chain of #defines

    (The original kernel busy-wait was intended for microsecond waits, then got resused by the driver because hey, it was there, scaling by 1000 is fine, right?)

    In re: mastodon.social/@whitequark/11

  9. A fabulous amount of source notes pop up

    {quote

    scsi_all.h started out life as a work by Julian Elischer to add SCSI
    support to CMU Mach 2.5. It was 373 lines. Julian ported this to 386BSD,
    included in the 386BSD patch kit and incorported into FreeBSD at its
    creation. Justin used this file when writing CAM, and imported it with
    the initial CAM import, but only 30% (100 lines) of the original
    remained. Justin moved from bitfields to bytes in structures, dropped
    the complex unions, and renamed many structures to have their length
    appended. Only about 30 structure names and about 40 #defines remained
    from the original. The define names were taken directly from the SCSI
    standard with spaces replaced by '_', so had no creativity. Apart from
    the license comment, there were no comments retained (all the comments
    in the CAM import were written by Justin and Ken). Even at that time,
    Justin and Ken could have put their copyrights and names and moved to an
    acknowledgement of Julian.

    In the almost 30 years since that original import, this file has grown
    to 4500 lines. Kenneth Merry, Alexander Motin and Justin Gibbs write
    85% of the file's lines, if mechanical commits are omitted. Other
    contributors contributed less than %5 each of the file.

    Replace the original license (which lacked a copyright even and has been
    criticized as ambiguous) with FreeBSD's standard 2-clause license. Add
    copyrights for Justin, Ken and Alexander, with the date ranges they
    contributed to the file. Add a note about the origin of the file to
    acknowledge Julian's original work upon which all this was built, though
    it's become a ship of Theseus in the mean time, built and rebuild many
    times.

    On an absolute scale, there's less than 1% of the current file with
    lines from the original, and those are named after the names in the SCSI
    standards and likely wouldn't qualify for copyright protection.

    Sponsored by: Netflix
    Reviewed by: mav, ken
    Differential Revision: reviews.freebsd.org/D49016

    End Quote}
    ^Z

    How wonderful to have learned this now

    #bash #csh #ksh #sh #freeBSD #SCSI #bhyve #jails #ZFS #programming #POSIX

    codeberg.org/FreeBSD/freebsd-s

  10. Baking does lots of stuff - light maps, visibility queries, SH probes, etc.

    This built system runs on top of a very simple distributed processing system - you just tell the system "run this linux command somewhere" and it just does it. No incredibuild here.

    They use ubershaders with #defines for each feature.

    They wrote their own GUI shader editor for artists. Programmers would "export" feature flags and settings, and an artist could play around with them. They hooked it up to Maya.

    4/10

  11. @samloonie I mean, it will flash successfully without even touching the button, and the hash/CRC claims to be correct. But there must be a half-dozen or more partitioning options in the IDE, and various other IDE tools options that appear to duplicate #defines in the code. But I'll look at what's on there now and see if anything is showing up on the serial port finally.

  12. @phil_stevens No OTA, just direct USB to the MD motherboard. There doesn't seem to be any serial anything. I could use a simple test program that is least likely to need trickier configurations, but the SDK is full of Tools settings, and it's not clear to me how these interact with the code's own #defines.

  13. @josch do note that the iso646.h header isn't for adding this functionality. you can add it using simple \#defines if you wanted to, but the iso646 header contains much more than that.

  14. INTERFACE spits out an .H file with the resource IDs and an .RSH file with the OBJECT and OBSPEC data all helpfully in arrays of C structs. the only problem is the output is for Pure C’s TOS lib and not MiNTlib so I need to include a file that converts the #defines first.

    But it means I should be able to whip up a loader that places the OBJECTs in my window’s OBJTREE, converts INTERFACE’s character grid coordinates to pixel grid coordinates, and places the container G_BOX where I want it

  15. GLSL-like swizzling in C++20

    * without #defines
    * using field syntax
    * supporting assignment
    * without UB (I think)

    godbolt.org/z/xY7Pxerez

  16. @Doomed_Daniel By the way, my favorite variant of X macros is to use a separate .inl file that's parameterized and configured by a bracketed set of #defines by the includers. It often lets you get away with much cleaner syntax.

  17. Eclipse Сборка с Помощью ARM GCC Плагинов

    В программировании микроконтроллеров часто используют Eclipse с плагинами. Главным образом от незнания языков скриптов сборки (Make, Cmake, Ninjia и т п). В этом тексте я напишут почему способ сборки из Eclipse c ARM плагинами - это тупиковый путь в разработке больших промышленных командных проектов. И как можно частично компенсировать недостатки Eclipse с плагинами.

    habr.com/ru/articles/794206/

    #eclipse #plugins #mcu #ARM #include #defines #пример_того_что_делать_не_стоит #Eclipse_Embedded_CDT

  18. After a little bit of fiddling around this morning, I've realised that the classes aren't in the order they come in the external files. In fact, I have no idea how they're ordered. I assume it's something to do with dependencies, but I can't see it.

    Like I said, it probably makes no difference - it's just a load of #defines. But I'd like to make it character-perfect at some point.

    I have other things to do today, but if I get a chance this evening I'll try using #ctran to compile something.

  19. @stuartmarks amusingly a few posts before this in my feed was complaints about namespace pollution from the Xlib.h header having for things like “Status” and “None” due to decisions made nearly 40 years ago, when X was just a fun experiment, not core system API.

  20. Have I ever mentioned how much I *hate* the C preprocessor? It poisons everything built on top of it, you make modern code with namespaces and such and it gets broken by the pre-namespace #defines in your thirty year old OS header files. You're building skyscrapers on sand. A significant portion of why I want to jump to Rust or Go is just to get away from the C preprocessor by itself

  21. @madcoder

    In the olden daze, a null pointer in C actually was a zero, and it pointed to address zero, and guess what was there? Zeros.

    So, a null string pointer pointed to a null string or zero int. And it worked.

    And then ANSI C came along, and NULL was no longer a zero pointer to zeroes, and whoa! Stuff broke.

    I spent a lot of time reworking the toolchains back then to wrap all of the C library functions via the preprocessor.

    Then, I wrote frontends for the libc functions that had the null pointer problem.

    Then, I made the build system use my frontend library which trapped the bad code.

    So, strcpy() became safe_strcpy() and if a null pointer came in, I would fix it on the fly, and also log the calling code so it could be fixed later.

    Oh, I had a common header file that almost all of the code #included so that made it easier. I just changed that common header file to include all of the #defines I needed from another header file, and like magic, all of the source code C calls to strcpy() (example), magically became calls to safe_strcpy(), and then the rest was linker magic because I controlled the build system so I could make it use my frontend wrapper library.

  22. I've also removed a huge number of preprocessor #defines and moved the constants that they created directly into code, which feels really weird in the abstract, but was the right call in this specific case.

    I love "this is usually wrong, *but*..." moves.

    There were a huge number of "#define FOO_PID 0x1234" defines, each of which were used once, defining the hardware ID burned into specific device models. Maintaining the list in 2 places was a pain, and it made automated tooling harder.

  23. Really hoping that companies will realize sooner than later that if any part of their pitch contains “NFT” that it is almost certainly a deal-breaker for me, and NOT a plus!

    Yeah, I’m looking at you HTC Viverse.
    (And yes, in addition, I'm not buying into your “VIVERSE” branding. All-caps are for acronyms, initials, and #defines.) :-)

    Now if you’ll excuse me, I have to go yell at some clouds…

    #NFT #Scam #HTC #Viverse #VirtualReality #VR