hksonngan / mandelbulber

Automatically exported from code.google.com/p/mandelbulber
GNU General Public License v3.0
0 stars 0 forks source link

"half" is a type name and should maybe not be used as a variable name #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In the files

cl/cl_engine.cl
cl_engine_fast.cl
cl_engine_full.cl
cl_engine_noDE.cl

there is code that looks like this:

float3 half = lightVector - viewVector;

However "half" is a already a type name: 
http://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/scalarDataTypes.html

For example clang (via mesa on linux) complains like this:
OpenCL Build log:       input.cl:323:10: error: cannot combine with previous 
'type-name' declaration specifier

(don't try to use mesa opencl, it doesn't work yet)

As a workaround the variable can just be renamed:
for i in /usr/share/mandelbulber/cl/*; do sed -i "s/half)/halfFOO)/g" $i; done
for i in /usr/share/mandelbulber/cl/*; do sed -i "s/half /halfFOO /g" $i; done

Original issue reported on code.google.com by haagch.c...@googlemail.com on 21 Aug 2014 at 12:01

GoogleCodeExporter commented 8 years ago

Original comment by buddhi1...@gmail.com on 21 Aug 2014 at 6:25