Notes for C family, like C++, Objective-C, ISPC, NVCC.
2023-06-08 | #Words: 3210
Recently, I suddenly discovered something when I was learning about clang/llvm: `gcc` is a collection of tools that includes or calls all tools that convert source code into executable program, not just a simple compiler. This helped me gain a deeper understanding of compilers, so I wrote this article as a record.
2023-05-16 | #Words: 2545
I just want to try to see whether is the case. I think the central limit theorem (CLT) and normal distribution are a very magical part of probability theory. I will use dice points as discrete events to calculate the probability of the sum of points. First, Implementing the program to simulate a uniformly distribute. Second, adjusting the probability of non-uniform distribution.
2023-05-12 | #Words: 967
In C language, there is a variable called union, which is used to store objects of different types and sizes in different situations. This is very similar to a struct: a struct is a collection of one or more variables. The declaration method of union is very simple and exactly the same as struct, as follows
2023-05-03 | #Words: 492
When using nvcc in the command line today, an error helper_cuda.h: No such file or directory appeared. This error message means: During compilation, the helper_cuda.h header file cannot be found (if other xxx.h cannot be found, the following explanations and solutions are also common).
2023-04-26 | #Words: 1293
typedef is a special feature in the C language, which is used to create new type names. You also can know from the name type def(ine). typedef is similar to alias program in Unix, which adds another name to an object. typedef also makes multiple names actually correspond to same objext, but the object of typedef operation is a data type. It is to give a nickname to the data type. This nickname usually has the first letter capitalized and is used to indicate that it is not an underlying data type.
2023-04-19 | #Words: 1005
enum is abbreviation of enumerate. It is a type of constant in C language, called enumeration constant. enum provides a convenient way to associate values and names, and it is an alternative to #define. enum can be regarded as a special array, which is a list of constants, but this constant just be integer. So if there are only a few irrelevant and discontinuous constants, just define some constants directly is fine.