Compare commits

...

2 Commits

Author SHA1 Message Date
Juhani Krekelä 08688c657c Add dependency for cmaybe.h 2018-08-11 11:19:40 +03:00
Juhani Krekelä 15eda1ea7b Add include guards 2018-08-11 10:37:24 +03:00
2 changed files with 8 additions and 0 deletions

View File

@ -1,5 +1,8 @@
all: average
average: average.c cmaybe.h
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $<
clean:
rm -f average

View File

@ -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(name) struct maybe_##name
@ -15,3 +18,5 @@
#define IS_VALUE(x) if((x).is_value)
#define IS_NOT_VALUE(x) if(!(x).is_value)
#define VALUE(x) (x).value
#endif