Quality RTOS & Embedded Software

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




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) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists