The header code generated contains typedef int bool; I am not sure if I want that in my header.
Automatic compilation of partially available C source code
11–18 of 18 posts
Re: Automatic compilation of partially available C source code
#12Earlier quoted context omitted.
Why not? C does not have a book type and it is standard to use either char or int, depending on if you're concerned about space or about time.
C does have a bool type as well. I have not seen it used much in the C code that I have encountered. See http://pubs.opengroup.org/onlinepubs/009695399/basedefs/stdb...
The actual boolean type is called _Bool, but provides macros that let bool, true, and false work.
Re: Automatic compilation of partially available C source code
#13The header code generated contains typedef int bool; I am not sure if I want that in my header.
What's the right type then? There is no bool type in C90. It appears in C99. I've seen this in the wild, including the top answer on a StackOverflow question: #define bool int http://stackoverflow.com/questions/4159713/how-to-use-boolea... Besides, if you want correct code, don't ask a tool to guess it! This tool is for patching up fragments enough to get them through the compiler front end analysis.
Re: Automatic compilation of partially available C source code
#14Re: Automatic compilation of partially available C source code
#15The header code generated contains typedef int bool; I am not sure if I want that in my header.
Re: Automatic compilation of partially available C source code
#16The header code generated contains typedef int bool; I am not sure if I want that in my header.
What I find weird is that it's not really used. Why generate bool, true, and false?
Re: Automatic compilation of partially available C source code
#17Aiui Eclipse JDT (and probably other IDEs too) do something similar. It takes code that currently is not valid and tries to massage the AST until it becomes valid so that it can perform type-inference and use the type information to offer valid autocomplete suggestions even at the currently invalid location.
Re: Automatic compilation of partially available C source code
#18Can somebody in simple but technical terms explain how this works? (I tried to no avail)
It builds the set of type and other constraints that must be fulfilled for the program to be valid. It uses a constraint solver to solve the set of constraints and generate a program that satisfies them. IE For "List list" to work, there must be a thing named List available as a typedef. For list = 0 to work, tlist must be a pointer or an int. For list->data to work, list must be a pointer to a struct, and that struc…