Compare commits
2 Commits
3ba365f113
...
08688c657c
Author | SHA1 | Date |
---|---|---|
Juhani Krekelä | 08688c657c | |
Juhani Krekelä | 15eda1ea7b |
3
Makefile
3
Makefile
|
@ -1,5 +1,8 @@
|
||||||
all: average
|
all: average
|
||||||
|
|
||||||
|
average: average.c cmaybe.h
|
||||||
|
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f average
|
rm -f average
|
||||||
|
|
||||||
|
|
5
cmaybe.h
5
cmaybe.h
|
@ -1,3 +1,6 @@
|
||||||
|
#ifndef __CMAYBE_H__
|
||||||
|
#define __CMAYBE_H__
|
||||||
|
|
||||||
#define MAYBE_TYPE(name, type) struct maybe_##name {type value; char is_value;}
|
#define MAYBE_TYPE(name, type) struct maybe_##name {type value; char is_value;}
|
||||||
#define MAYBE(name) struct maybe_##name
|
#define MAYBE(name) struct maybe_##name
|
||||||
|
|
||||||
|
@ -15,3 +18,5 @@
|
||||||
#define IS_VALUE(x) if((x).is_value)
|
#define IS_VALUE(x) if((x).is_value)
|
||||||
#define IS_NOT_VALUE(x) if(!(x).is_value)
|
#define IS_NOT_VALUE(x) if(!(x).is_value)
|
||||||
#define VALUE(x) (x).value
|
#define VALUE(x) (x).value
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue