Skip to content

Instantly share code, notes, and snippets.

@brabect1
brabect1 / make_intermediate.md
Created October 14, 2016 07:25
GNU Make and the effects of intermediate targets.

Intermediate files in make's terminology is a file needed somewhere on way from a source file to target file. An examples is a file.c needed to create file.o from file.y (YACC source). From that principle, an intermediate file is needed only once to generate the target after the source changed and thus can be removed after it was used. Therefore, an intermediate file which did not exist before make also does not exist after make (see [gnu_rule_chains]). In other words, make removes the intermediate files it needed to create (unless .SECONDARY or .PRECIOUS is used). For details refer to [gnu_rule_chains].

That being said, the use of explicit intermediate files (i.e. .INTERMEDIATE) is rarely needed. Often one either really wants to see the itermediate files too (thus making explicit targets and dependencies and remove

@psych0der
psych0der / ftos.c
Created August 23, 2013 13:16
converting float to string without using library function like sprintf (naive approach , may lead to anomalies)
#include <stdio.h>
#include <math.h>
#define precision 6 //precision for decimal digits
int main(int argc, char const *argv[])
{
float f,ff;