xC Task scope variable initial value

Technical questions regarding the XTC tools and programming with XMOS.
teachop
Active Member
Posts: 47
Joined: Wed Feb 05, 2014 1:25 am

xC Task scope variable initial value

Post by teachop »

The variables in a task look like automatics in a c function. In c the initial state for automatics is unknown. Is this also true of task scope variables in xC, or are they guaranteed to be zero like file scope or global variable would be in c?

Thanks!
User avatar
davelacey
Experienced Member
Posts: 104
Joined: Fri Dec 11, 2009 8:29 pm

Post by davelacey »

They have an undefined initial value. There are no "tasks" as such in the language. You just have functions like in C. We tend to call them tasks if their main use case is to be called to run in parallel via a 'par' statement.
teachop
Active Member
Posts: 47
Joined: Wed Feb 05, 2014 1:25 am

Post by teachop »

Thank you! Also your description of tasks is helpful, I had assumed that par{} triggered special code generation for the function. I have lots to learn...