Commit af2ccc35 authored by Artak Yenokyan's avatar Artak Yenokyan

Merge branch 'exe_46' into 'master'

exercise_06_46, version1

See merge request bpcarm/trainings2017!1326
parents d573f271 585c2737
progname = exercise_06_46
CC = g++
CFLAGS = -Wall -Wextra -Werror -g3
$(progname): $(progname).o | .gitignore
$(CC) $(CFLAGS) $^ -o $@
%.ii: %.cpp
$(CC) -E $(CFLAGS) $< -o $@
%.s: %.ii
$(CC) -S $(CFLAGS) $< -o $@
%.o: %.s
$(CC) -c $(CFLAGS) $< -o $@
.gitignore:
echo $(progname) > $@
clean:
rm -f *.ii *.s *.o *.out $(progname) .gitignore
test: $(progname)
./$(progname)
# diff $@.out $@.expected && echo PASSED || echo FAILED
.PRECIOUS: $(progname).ii $(progname).s
.SECONDARY: $(progname).ii $(progname).s
#include <iostream>
int
main()
{
static int count = 1;
std::cout << "Calling main fuction recursively. Count's value is " << count << std::endl;
count++;
main();
return 0;
}
///main() function is called recursively, count's value is different each time the program is running
///and core dumpes, which means the stack, that has 1 mb size, is already full.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment