On Thu, Feb 02, 2006 at 11:05:28PM -0500, Michael Jennings wrote:
On Wednesday, 01 February 2006, at 22:05:57 (-0500),
Kris Maglione wrote:
+/* XXX:
+ * This should probably be done another way, but this way
+ * is better than leaving the chance of a non-terminated
+ * string (which has afflicted me once already) */
+#define snprintf(str, size, format, ...) do { \
+ snprintf(str, size, format, ##__VA_ARGS__); \
+ (str)[size-1] = 0; \
+ } \
+ while (0)
Negative. This is not portable.
I know that it's not portable, I just said that something needs to be done and
that that does it. I also said that it should be done better.
-#ifdef HAVE_PAM
- if (e->config->auth == ENTRANCE_USE_PAM)
+ if (HAVE_PAM && e->config->auth == ENTRANCE_USE_PAM)
This is horrible. Compile-time directives masquerading as run-time
conditionals is just evil.
I knew that at least one person would say that. I wouldn't call it
'Compile-time directives masquerading as run-time conditionals', either.
HAVE_PAM is not a compile time directive, it is a macro, that is read as a
compile-time constant. Using it in in if conditional rather than a
pre-processor ifdef makes the code easier to read and makes debugging easier,
since the compiler actually has some concept of code flow, where the
pre-processor doesn't. As for it being horrible, there are plenty of people
who will argue that ifdefs are horrible. The plan9 C compiler, for instance,
doesn't include an #if directive, and relies on the if statement and optimizer
instead, D doesn't include a preprocessor at all and relies on the same
principal, and the GNU style guide (which I tend to disagree with) recommends
using that method in all GNU software.
Anyway, this isn't my project, and I won't argue its main authors on points of
style, like I said. It's just a matter of my preference.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel