What's wrong with this picture?
1
Name:
Anonymous
2008-02-08 18:02
#define incl(var, count) for (int var = 0; var < (count); var++)
#define decl(var, count) for (int var = (count) - 1; var >= 0; var--)
2
Name:
Anonymous
2008-02-08 18:06
bind f {xg,sg) = let (xf,sf) = f xg in (xf,sf++sg)
3
Name:
Anonymous
2008-02-08 19:14
>>1
var = (count) - 1 ; var >= 0
WHY?
(Yes, the compiler will fix it, but it still takes longer to type than the unretarded equivalent.)
4
Name:
Anonymous
2008-02-08 19:20
macros are for fags
5
Name:
Anonymous
2008-02-08 20:01
>>3
Because you might want to
use var as index for some array, of course.
6
Name:
Anonymous
2008-02-08 20:04
(defmacro decl (var init &body the-body)
`(progn
(size_t ,var = ,init)
(while (var--)
,@the-body)))
7
Name:
Anonymous
2008-02-08 22:34
Count is reevaluated on every iteration in the first case.
8
Name:
Anonymous
2008-02-09 2:20
>>1
incl/decl takes two parameters, var and count.
Then, in the macros body you define a `var` object. MADNESS.
9
Name:
Anonymous
2008-02-09 2:30
10
Name:
Anonymous
2008-02-09 2:41
11
Name:
Anonymous
2008-02-09 2:57
>>5,8
Are you stupid? You choose a variable name to be substituted in. If you want to use "var" for anything, it is undisturbed. And there is no "var" "object" defined. When you expand
incl(i,3), you get
for (int i = 0; i < (3); i++). Srsly, l2macros.
12
Name:
Anonymous
2008-02-09 3:05
>>11
int i;
incl(i, 3); srsly?
13
Name:
Anonymous
2008-02-09 3:27
>>12
No, just
incl(i,3) { /* do some stuff */ }. Lol C99/Sepples.
14
Name:
Anonymous
2008-02-09 3:31
>>13
You don't understand
>>12 .
15
Name:
Anonymous
2008-02-09 5:37
Why the hell would you use so fucking retarded macros
While you are at it
#define ever (;;)
for ever scat
16
Name:
Anonymous
2008-02-09 7:04
>>15
I had a lecturer who insisted on
#define forever for(;;)
I guess it makes sense
17
Name:
>>15
2008-02-09 7:43
>>16
That lecturer was a fucking moron.
I would
NEVER want to see such code in one of my projects.
18
Name:
Anonymous
2008-02-09 10:50
those who can't, teach
19
Name:
2010-09-09 10:11