I am trying to get some c code I developed on a mac to work on my windows machine. In the code, I defined a struct to represent each vertex, containing 4 floats for vertex position (x, y, z, w), and 4 floats for the vertex normal vector (nx, ny, nz, nw). I then made an array of these structs and cast it to an array of floats to create a striped array of vertex data for use with a vertex buffer object in OpenGL. This worked fine in xcode (which uses clang compiler?).
On my windows machine, using mingw and gcc, when I print out the cast array in the console, I get garbage. I'm guessing my assumption that the floats inside the struct would be lined up nicely in memory and without padding is wrong under certain compilers. Is there a way to make this work?