Reputation
13,495
Top tag
Next privilege 15,000 Rep.
Protect questions
Badges
1 35 65
Newest
 Nice Answer
Impact
~556k people reached

Feb
5
answered Avoiding Division by Zero Using Float Comparison
Jan
25
awarded  Nice Answer
Jan
16
awarded  Talkative
Jan
14
comment Methods of debugging code (Nightmare situation)
Given requirement #1 the only way to be effective at debugging this mess is to be clairvoyant. Seriously, there is no magic bullet that is going to make this anything but a crapshoot. In some ways this should take some pressure off of you, since debugging is necessarily a matter of luck. Or is your management going to order you to be lucky? Clearly this isn't sustainable, so you should be looking for other opportunities.
Dec
10
answered How supervised or unsupervised machine learning algorithms get better over new datasets
Nov
20
awarded  Good Answer
Oct
17
comment What are the advantages of matrix multiplication over individual variables (graphics)?
Ah! I see what you are getting at now. The trick is that the most general transformation matrix is highly structured. In 2d, the first two columns of the 3rd row will always be 0, which makes many of the normal operations pointless. A general matrix multiplication function won't take advantage of that, but you could write a specialized matrix multiplication function limited to transformation matrices, which would. It's innards would end up looking a lot like the arithmetic in your main().
Oct
17
comment What are the advantages of matrix multiplication over individual variables (graphics)?
That may be what's confusing you. The tutorials you were looking at seem to be doing 3d transforms (note the Z coordinate). For 2d transforms your expression is correct, but 2d transforms are described by 2x2 matrixes, so you end up with the same number of arithmetic operations as with your expression. The geometry is the geometry, matrix multiplication is just a concise way to write it.
Oct
17
comment What are the advantages of matrix multiplication over individual variables (graphics)?
Are you talking about 3d or 2d transformations? Your expression using scale_x, sin_a, etc. only covers scaling, translation, and rotation in a 2-d plane. It's missing a 'z' coordinate. For scaling, translation, and rotation in 3-d you indeed need a 3x3 matrix.
Oct
8
awarded  Yearling
Aug
27
comment Why are C string literals read-only?
'So string literals are stored in program memory, not RAM, and buffer overflow would result in the corruption of program itself?' The program image is in RAM too. To be precise, the string literals are stored in the same segment of RAM used to store the program image. And yes, overwriting the string could corrupt the program. Back in the days of MS-DOS and CP/M there was no memory protection, you could do stuff like this, and it usually caused terrible problems. The first PC viruses would use tricks like that to modify your program so it formatted your hard drive when you tried to run it.
Aug
6
comment Are data type declarators like “int” and “char” stored in RAM when a C program executes?
@user16307 Otherwise how can console or text file outputs a character instead of int Because there is a different sequence of instructions for outputting the contents of a memory location as an integer or as an alphanumeric characters. The compiler does know about the variables types, and chooses the appropriate sequence of instructions at compile time, and records it in the EXE.
Jul
26
awarded  Guru
Jul
25
awarded  Good Answer
Jul
25
awarded  Nice Answer
Jul
20
comment rand() gives same numbers again for a small range
Next, rand() is typically a linear congruential generator This isn't true on many platforms now. From the rand(3) man page of linux:" The versions of rand() and srand() in the Linux C Library use the same random number generator as random(3) and srandom(3), so the lower-order bits should be as random as the higher-order bits." Also, as @delnan points out, the quality of the PRNG isn't the real problem here.
Jul
17
answered Why isn't programming mobile apps more similar to programming desktop applications?
Jul
10
comment In C, how are functions accessible if they're not inline or called by #include?
@Volumetricsteve that's almost certainly the case, but keep in mind that compiling and linking are separate processes in C. If your code is referring to functions or datatypes defined in a different library, those will need to get declared in your program before it will compile. This is almost certainly happening via the include of some header file. Exactly where it's occuring may be obscured by nesting, For example, you include file "foo.h", which in turn includes "bar.h", which includes "png_magic.h", which provides the needed declarations.
Jul
10
revised In C, how are functions accessible if they're not inline or called by #include?
deleted 36 characters in body
Jul
10
answered In C, how are functions accessible if they're not inline or called by #include?