This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28335: GCC Nested Function Extension for C2000 compiler

Part Number: TMS320F28335


Hello all, I am just trying to do a simple nested function poc.  I tried compiling the below code with --c99 and --relaxed_ansi compiler flags as that indicated it would allow those extensions but no luck.  The compiler gives an error of expected a ';' where I try to define double square(double z)

Can anyone point out what I am missing in getting this to compile?  Note I am using compiler TI v20.2.4.LTS

#include <stdarg.h>
#include <string.h>

double foo (double a, double b)
{
    double square (double z)
    {
        return z * z;
    }
    return square (a) + square (b);
}

int main(void)
{
    int i = 0;
    i = foo(3,3);
    return i;
}