[rant]
I'm just fuming here, but just to give you an idea of how badly implemented the NIST code is:
Code:
if ( ((X = (double*) calloc(n,sizeof(double))) == NULL) ||
((wsave = (double *)calloc(2*n+15,sizeof(double))) == NULL) ||
((ifac = (double *)calloc(15,sizeof(double))) == NULL) ||
((m = (double*)calloc(n/2+1, sizeof(double))) == NULL) ) {
fprintf(stats[7],"\t\tUnable to allocate working arrays for the DFT.\n");
if( X == NULL )
free(X);
if( wsave == NULL )
free(wsave);
if( ifac == NULL )
free(ifac);
if( m == NULL )
free(m);
return;
}
Can we say "memory leak" (although "hemorrhage" might be more appropriate, considering the sizes involved)?
Besides that, the programmer seemed way too comfortable with using goto's, including one bit where he had a goto jump directly to another goto instead of directly to the target!
Oh and did I mention the so-called user-interface? It's menu based and honestly, I've seen better systems implemented by the newb's that post their homework assignments here!
And then there are the functions that modify global variables in ways that can have side-effects on other unsuspecting functions unless special steps are taken.
Oh the humanity!
[/rant]
Ok, I'm done. =D