Skip to main content
21 events
when toggle format what by license comment
Jan 12, 2022 at 13:54 comment added user245050 I ran the same code on a linux system and I got the sign conversion warning. It looks like gcc on cygwin hasn't implemented the sign conversion flag(s) in gcc.
Jan 12, 2022 at 12:40 comment added chux @Amit Hmmm, compiler is smart and sees strlen("abcde") is 5 and knows that long is not an issue. Try a non-fixed string. long foo(char *s) { return strlen(s); }
Jan 12, 2022 at 7:58 comment added user245050 Chux, on cygwin, I am doing long x = strlen("abcde"); and am using the flags mentioned above when compiling. But I don't get any warning about sign change. The flags that I use are: -Wall, -Werror, -Wextra, -Wundef, -Wunreachable-code, -Winit-self, -Wparentheses, -Wconversion, -Wsign-conversion, -Wsign-compare, -Werror-implicit-function-declaration, -Wmissing-prototypes, -Wmissing-declarations, -Wformat-security.
Jan 6, 2022 at 13:47 history edited Toby Speight CC BY-SA 4.0
Formatting fix
Dec 31, 2021 at 11:33 comment added user245050 Ok. On my system this doesn't crash. I am using gcc. But its quite possible that it may crash on some other C compiler or some other C library which doesn't handle NULL values in printf.
Dec 31, 2021 at 11:11 comment added chux @Amit, re "Undefined behavior printing a null pointer - how will it crash? How is it unbounded?" to attempt to use "%s" with an invalid pointer -- it is undefined (UB), there is no prescribed way it will crash - it is not defined. It might "work", it might crash in various ways. If you still want to print something reliable when s == NULL, instead of printf("%s\n", s); use printf("%s\n", s ? s : "null");
Dec 31, 2021 at 7:42 comment added user245050 Chux, Minor: avoid !: I got a review comment in some other posting to avoid (temp == NULL) and use !temp. So, this is a subjective issue. Personally, I prefer !temp but sometimes I use temp == NULL also.
Dec 31, 2021 at 7:39 comment added user245050 Chux, Define when needed: I already gave my comments on this in the review comments of strcat_new().
Dec 31, 2021 at 7:38 comment added user245050 Chux, Zero num_args: I already gave my comments on this in the review comments of strcat_new().
Dec 31, 2021 at 7:38 comment added user245050 Chux, NULL is not safe as a ... argument: I already gave my comments on this in the review comments of strcat_new().
Dec 31, 2021 at 7:36 comment added user245050 Chux, on your comment: Undefined behavior printing a null pointer - how will it crash? How is it unbounded?
Dec 31, 2021 at 7:22 comment added user245050 I will fix the description. Basically, the delim is between valid (non-null and non-empty) strings (arguments). I also need to fix the empty string(s) case - if the user passes empty string(s) then these empty string(s) will not be concatenated/joined and will be ignored.
Dec 8, 2021 at 0:17 comment added chux @Deduplicator Nice alternative way to say it. Issue brought up before. Unclear if OP wants to address it.
Dec 7, 2021 at 23:57 comment added Deduplicator Maybe add: Contradictory description: Is delim inserted between any two, or after every single argument...
Dec 7, 2021 at 20:29 history edited chux CC BY-SA 4.0
added 663 characters in body
Dec 7, 2021 at 20:19 history edited chux CC BY-SA 4.0
added 70 characters in body
Dec 7, 2021 at 20:13 history edited chux CC BY-SA 4.0
added 70 characters in body
Dec 7, 2021 at 20:06 history edited chux CC BY-SA 4.0
added 70 characters in body
Dec 7, 2021 at 19:59 history edited chux CC BY-SA 4.0
added 70 characters in body
Dec 7, 2021 at 19:45 history edited chux CC BY-SA 4.0
added 70 characters in body
Dec 7, 2021 at 19:38 history answered chux CC BY-SA 4.0