Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Macro-writing challenge

Name: Anonymous 2016-01-16 13:19

Write a macro check-arguments-non-nil to be used in function definitions, that would expand to assertion about every argument being non-nil.
The intended usage of this macro:

(defun foo (a b c d)
(check-arguments-non-nil)
foo-body)


This should expand to:

(defun foo (a b c d)
(assert (and (not (null a)) (not (null b)) (not (null c)) (not (null d)))
(a b c d)
"Null argument in FOO")
foo-body)


The macro must work whatever the number and names of the function parameters.

Name: Anonymous 2016-01-23 12:20

>>89
C preprocessor is simpler and is always present with a C compiler - its part of C standard. TCL could be used as preprocessor( www.drdobbs.com/open-source/c-preprocessing-with-tcl/184410635 ) if you add it as dependency, but extending the preprocessor(_TokenOf()) is more beneficial long-term, since even Tcl is in C.
Any extension in the preprocessor benefits the entire software industry since at the base its layer of C code & C macros(and can be used with Assembler).
There tons of C macros in every large C project, like e.g. Linux kernel. Making them less verbose, less cryptic and complex would actually be useful and orderPP would be useless.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List