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 #286627 Post edited:
almost 2 years ago
Edit Post #286627 Post edited:
almost 2 years ago
Edit Post #286627 Initial revision almost 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)
almost 2 years ago
Edit Post #286605 Post edited:
links
almost 2 years ago
Edit Post #286605 Post edited:
almost 2 years ago
Edit Post #286605 Post edited:
almost 2 years ago
Edit Post #286605 Post edited:
almost 2 years ago
Edit Post #286605 Post edited:
almost 2 years ago
Edit Post #286605 Post edited:
almost 2 years ago
Edit Post #286605 Initial revision almost 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)
almost 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)
almost 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)
almost 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)
almost 2 years ago
Edit Post #286578 Post edited:
almost 2 years ago
Edit Post #286578 Post edited:
almost 2 years ago
Edit Post #286578 Post edited:
experimental data
almost 2 years ago
Edit Post #286578 Post edited:
add link to NGINX Unit
almost 2 years ago
Edit Post #286578 Post edited:
almost 2 years ago
Edit Post #286578 Post edited:
array of pointers really uses a lot more space
almost 2 years ago
Comment Post #286575 Ahh, you're right. Just some confusion of mine then. For some reason I thought I needed to discard the const in some code, but I don't need to.
(more)
almost 2 years ago
Edit Post #286578 Initial revision almost 2 years ago
Question array of arrays vs array of pointers to store array of string literals
Let's consider the following code: ```c const char a[][4] = {"aa", "aaa"}; const char b[] = {"bb", "bbb"}; const char const c[] = {"cc", "ccc"}; ``` For shared libraries, both `b` and `c` arrays require the array of pointers to be generated at runtime, which implies performance costs. Se...
(more)
almost 2 years ago
Comment Post #286575 But I'm discarding it from `r->s`, which is `const char *`.
(more)
almost 2 years ago
Edit Post #286575 Post edited:
__auto_type
almost 2 years ago
Edit Post #286575 Post edited:
almost 2 years ago
Edit Post #286575 Initial revision almost 2 years ago
Question How to write a macro that discards the const qualifier, for any type?
How to write a macro that discards the const qualifier, for any type? I hope some combination of `typeof` and a cast will do, but haven't found the combination. I tried this, without luck: ```c #define discardconst(x) ((typeof(x + 0)) (x)) struct t { char s; }; char foo(const...
(more)
almost 2 years ago
Edit Post #286573 Post edited:
almost 2 years ago
Edit Post #286573 Initial revision almost 2 years ago
Question PGP sign emails sent with git-send-email(1)
How can we use git-send-email(1) to sign patches (emails) with the gpg(1) keyring? I've heard it can be done, but couldn't find anything in the git-send-email(1) documentation nor in a web search.
(more)
almost 2 years ago
Comment Post #286302 Hmm, interesting. I'll copy here a link to the c99(1) specification for completeness: <https://pubs.opengroup.org/onlinepubs/9699919799/utilities/c99.html>. My question was about portability to Unix systems, including systems about which I don't know much, such as Solaris or HPUX for example. If...
(more)
about 2 years ago
Edit Post #286302 Post edited:
tfix
about 2 years ago
Edit Post #286302 Post edited:
about 2 years ago
Edit Post #286302 Post edited:
about 2 years ago
Edit Post #286302 Initial revision about 2 years ago
Question Is `-isystem` a POSIX cc option?
Is `-isystem/path/to/sys/includes` a standard compiler option, or is it a compiler extension implemented by gcc, clang, and maybe other compilers? Can I rely on its availability? I couldn't find the POSIX specification for cc(1).
(more)
about 2 years ago
Comment Post #285974 Might be, yes. I usually return. But I was reviewing some existing code that used that scheme. But I tend to agree :)
(more)
about 2 years ago
Edit Post #285972 Post edited:
ffix
about 2 years ago
Edit Post #285946 Post edited:
ffix
about 2 years ago
Comment Post #285974 @#8176 In this case, `noreturn` doesn't help the compiler optimize, because it can't optimize (and in fact it would be wrong to optimize, since `pthread_create(3)` expects a function that actually returns, and providing something different (`void`) might be UB (but it happens to be compatible by the ...
(more)
about 2 years ago
Comment Post #285974 Calling `pthread_exit(3)` instead of returning from the callback is the same as calling `exit(3)` instead of returning from `main()`. It's not like you're killing it with a signal or anything like that. It handles everything gracefully and acts as if it returned: _"The pthread_exit() function term...
(more)
about 2 years ago
Edit Post #285972 Post edited:
about 2 years ago
Edit Post #285972 Post edited:
about 2 years ago
Edit Post #285972 Initial revision about 2 years ago
Question noreturn function with non-void return type
Is it legal ISO C to declare a function as `noreturn` with a non-`void` return type (but of course not actually returning)? As far as I can read from the standard, it seems legal. Example: ``` c noreturn void foo(void x) { pthreadexit(x); } ``` ISO C (N2731, C2x) says: > 6.7...
(more)
about 2 years ago
Edit Post #285946 Post edited:
show len usage
about 2 years ago
Edit Post #285946 Post edited:
Add usage
about 2 years ago
Comment Post #285946 Of course, if one has portability issues, it can just `#define _Nonnull` to nothing for some compilers that lack support (right now only Clang supports it, AFAIK). Or simply manually remove the text. But for this showcase implementation, I'd like to be as explicit as possible, especially in the int...
(more)
about 2 years ago