Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Activity for alx‭

Type On... Excerpt Status Date
Edit Post #287522 Post edited:
about 2 years ago
Edit Post #287522 Post edited:
about 2 years ago
Edit Post #287522 Post edited:
about 2 years ago
Edit Post #287522 Post edited:
about 2 years ago
Edit Post #287522 Initial revision about 2 years ago
Answer A: stpecpy(): Design a better string copy function that truncates
After addressing @Lundin 's suggestions: - Implemented in terms of libc functions for performance. - const correctness - style improvements I have a few more that I realized after trying to replace some existing code: Much code out there has `char end = buf + nitems(buf);` (although that s...
(more)
about 2 years ago
Edit Post #287345 Post edited:
parentheses
about 2 years ago
Edit Post #287345 Post edited:
about 2 years ago
Edit Post #287345 Post edited:
about 2 years ago
Edit Post #287345 Post edited:
decay arrays
about 2 years ago
Edit Post #287345 Post edited:
about 2 years ago
Edit Post #287345 Initial revision about 2 years ago
Answer A: How to write a macro that discards the const qualifier, for any type?
I developed this macro (using GNU C) similar to C++'s constcast(). ```c #define constcast(t, p) \ ({ \ staticassert(builtintypescompatiblep(typeof(&(p)), const t)); \ ...
(more)
about 2 years ago
Comment Post #286578 I was wondering about Unix systems in general, and Linux if there are differences across Unices.
(more)
over 2 years ago
Comment Post #286628 ... The static assert would need to be at call site, but that would not make sure the function is not referenced anywhere else in the code. And a static assert at the A_* function definitions would always be triggered, as long as the functions are being compiled. I only want to trigger it if t...
(more)
over 2 years ago
Comment Post #286628 Okay, so the problem (the current code I'm dealing with) is: A program might be compiled with support for feature A, or without support for it (I guess for having a slimmer/faster binary). The feature is basically some A_*() functions, and some calls to those functions from core functions. Rig...
(more)
over 2 years ago
Edit Post #286628 Post edited:
tfix
over 2 years ago
Edit Post #286628 Post edited:
renamed landmine() to assert_not_present_in_binary_if(), per Dirk's suggestion.
over 2 years ago
Comment Post #286628 That makes sense to me :) Thanks!
(more)
over 2 years ago
Edit Post #286628 Post edited:
over 2 years ago
Edit Post #286628 Post edited:
over 2 years ago
Edit Post #286628 Post edited:
over 2 years ago
Edit Post #286628 Post edited:
over 2 years ago
Edit Post #286628 Post edited:
over 2 years ago
Edit Post #286628 Post edited:
over 2 years ago
Edit Post #286628 Post edited:
over 2 years ago
Edit Post #286628 Initial revision over 2 years ago
Answer A: Assert that some code is not present in the final binary, at compile or link time.
Calling an undefined function will have that behavior at link time: `landmine.c`: ```c #ifndef CONSTANT #define CONSTANT 0 #endif #define assertnotinbinaryif(e) do \ { \ if (e) \ undefinedfunction(); \ } while (0) void undefinedfunction(void); [[gnu::noipa]] static void foo0(vo...
(more)
over 2 years ago
Edit Post #286627 Post edited:
over 2 years ago
Edit Post #286627 Post edited:
over 2 years ago
Edit Post #286627 Post edited:
over 2 years ago
Edit Post #286627 Post edited:
over 2 years ago
Edit Post #286627 Post edited:
over 2 years ago
Edit Post #286627 Post edited:
over 2 years ago
Edit Post #286627 Post edited:
over 2 years ago
Edit Post #286627 Initial revision over 2 years ago
Question Assert that some code is not present in the final binary, at compile or link time.
I'd like to assert that some code can be optimized out, and is not present in the final binary object. ```c #define CONSTANT 0 #if (!CONSTANT) [[landmineA]] #endif static int foo(void); void bar(void) { if (CONSTANT) { foo(); } } static int foo(void) { if (...
(more)
over 2 years ago
Edit Post #286605 Post edited:
links
over 2 years ago
Edit Post #286605 Post edited:
over 2 years ago
Edit Post #286605 Post edited:
over 2 years ago
Edit Post #286605 Post edited:
over 2 years ago
Edit Post #286605 Post edited:
over 2 years ago
Edit Post #286605 Post edited:
over 2 years ago
Edit Post #286605 Initial revision over 2 years ago
Answer A: PGP sign emails sent with git-send-email(1)
It can't be done with `git-send-email`(1), but there's a tool that integrates with it, and is very simple to use: `patatt`(1). Install the tool: ```sh $ sudo apt-get install patatt ``` And then for each repo in which you want to sign patches, run: ```sh $ cd /some/git/repo/ $ patatt ins...
(more)
over 2 years ago
Comment Post #286593 Yes, that's by far the simplest one. I was wondering if there was one that was more useful, in terms of type-generic programming, so that it would discard the `const` qualifier from any type. `_Generic` would help, but it's still limited to the types you specify.
(more)
over 2 years ago
Comment Post #286588 Considering that I'm asking this for use in a public mailing list, option 1 is not possible, option 2 defeats the simplicity and versatility of email patches, so option 3 remains. In fact, yes, a web of trust is what I was looking for (accept more or less blindly patches from specific persons, the...
(more)
over 2 years ago
Comment Post #286575 Agree. I don't even remember why that solution came through my mind. I didn't ask to close the question, just for curiosity of the answers :)
(more)
over 2 years ago
Edit Post #286578 Post edited:
over 2 years ago
Edit Post #286578 Post edited:
over 2 years ago