Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

Structure visibility limitations

Posted by Mark Samarin on December 16, 2012
Having typedefs in the .c files rather than in the .h files makes things somewhat inconvenient.

For instance, I would like to look into the tskTaskControlBlock structure for some realtime diagnostics of my own but because the structure is invisible I have to make a copy of it locally, which of course is dangerous if any future changes to the structure are made.

Is this necessary because of the conditional compilation parameters?

RE: Structure visibility limitations

Posted by Dave on December 16, 2012
This has been discussed a few times and the answer is always "the source code follows good engineering practice". In a way you show the reason why in your question.

Think of it in terms of a C++ class. There are the public definitions and the private definitions. The private definitions exist for a reason, one of which is to prevent users accessing the internal workings directly because the internal workings might change. So the private section prevents updates in the implementation of the C++ class breaking applications that make use of the class.

FreeRTOS is not C++ but the principal is the same.

“because the structure is invisible I have to make a copy of it locally, which of course is dangerous if any future changes to the structure are made”


and if the structure was public and it changed that too would break your code so it makes no difference.

Some people prefer it one way, the more academic engineers prefer it the other.

RE: Structure visibility limitations

Posted by Mark Samarin on December 24, 2012
because the structure is invisible I have to make a copy of it locally, which of course is dangerous if any future changes to the structure are made

"and if the structure was public and it changed that too would break your code so it makes no difference."

That's not true if I am accessing elements in the structure that have not changed and I fully rebuild. In most cases this would be the case as typically things would be added to the structure, not modified.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS