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 #287748 Post edited:
over 1 year ago
Edit Post #287748 Post edited:
Use wider types, which will more-likely show atomicity problems
over 1 year ago
Edit Post #287748 Post edited:
over 1 year ago
Edit Post #287748 Post edited:
over 1 year ago
Edit Post #287748 Post edited:
over 1 year ago
Edit Post #287748 Post edited:
over 1 year ago
Edit Post #287748 Post edited:
over 1 year ago
Edit Post #287748 Post edited:
over 1 year ago
Edit Post #287748 Post edited:
over 1 year ago
Edit Post #287748 Initial revision over 1 year ago
Question Strict aliasing rules and function boundaries
Let's analyze this code, assuming an architecture where the alignment of `int64t` is the same as that of `double`: ```c void bar(double f, int64t j) { (int64t )f = j; } void foo(void) { int64t i = 1; bar((double ) &i, &i); } ``` - The object is of type `int64t`. - ...
(more)
over 1 year ago
Edit Post #287522 Post edited:
ffix
over 1 year ago
Edit Post #287522 Post edited:
reorder params
over 1 year ago
Edit Post #285946 Post edited:
over 1 year ago
Edit Post #287522 Post edited:
revert last change. ***cat() functions have the common meaning of appending after finding a NUL; this one doesn't.
over 1 year ago
Edit Post #287522 Post edited:
Rename to stpecat()
over 1 year ago
Edit Post #287522 Post edited:
over 1 year ago
Edit Post #287522 Post edited:
over 1 year ago
Edit Post #287522 Post edited:
over 1 year ago
Edit Post #287522 Post edited:
over 1 year ago
Edit Post #287522 Post edited:
over 1 year ago
Edit Post #287522 Initial revision over 1 year 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)
over 1 year ago
Edit Post #287345 Post edited:
parentheses
over 1 year ago
Edit Post #287345 Post edited:
over 1 year ago
Edit Post #287345 Post edited:
over 1 year ago
Edit Post #287345 Post edited:
decay arrays
over 1 year ago
Edit Post #287345 Post edited:
over 1 year ago
Edit Post #287345 Initial revision over 1 year 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)
over 1 year ago
Comment Post #286578 I was wondering about Unix systems in general, and Linux if there are differences across Unices.
(more)
almost 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)
almost 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)
almost 2 years ago
Edit Post #286628 Post edited:
tfix
almost 2 years ago
Edit Post #286628 Post edited:
renamed landmine() to assert_not_present_in_binary_if(), per Dirk's suggestion.
almost 2 years ago
Comment Post #286628 That makes sense to me :) Thanks!
(more)
almost 2 years ago
Edit Post #286628 Post edited:
almost 2 years ago
Edit Post #286628 Post edited:
almost 2 years ago
Edit Post #286628 Post edited:
almost 2 years ago
Edit Post #286628 Post edited:
almost 2 years ago
Edit Post #286628 Post edited:
almost 2 years ago
Edit Post #286628 Post edited:
almost 2 years ago
Edit Post #286628 Post edited:
almost 2 years ago
Edit Post #286628 Initial revision almost 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)
almost 2 years ago
Edit Post #286627 Post edited:
almost 2 years ago
Edit Post #286627 Post edited:
almost 2 years ago
Edit Post #286627 Post edited:
almost 2 years ago
Edit Post #286627 Post edited:
almost 2 years ago
Edit Post #286627 Post edited:
almost 2 years ago