Last active
January 22, 2016 13:04
-
-
Save abrarShariar/36d1d633f1633b1a047d to your computer and use it in GitHub Desktop.
SPV, push_back() , push_front
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "spv.h" | |
void main(){ | |
SPV test; | |
SPVconstruct(3,&test); //this shows 3 garbage values | |
//SPVconstruct(0,&test); //this works fine | |
int i; | |
for(i=0;i<3;i++){ | |
SPVpush_back(&test,999); | |
//SPVpush_front(&test,999); | |
} | |
SPVprint(&test); //prints some garbage values | |
} |
Check it now and let me know.
Added zero initialization and a simple optimization in case compiler already did it.
Thanks a lot for finding this bug.
It is working fine
Zero padded
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Found problem and fixed, my compiler GCC zero initializes malloc by default, but your compiler MingW does not. Now I've updated it to manually zero initialize by default and added another Constructor without zero initialization.