How do you structure your code? What I mean by this is what's your program's workflow? Do you have everything in one file, or do you spread everything out over multiple files and use the #include function?

I'm hoping to plan out a new structure for our team's code this year and would love ideas. Thanks in advance!

Tue Sep 12, 2017 8:59 pm

CARBOT

Expert

Joined: Thu Dec 01, 2011 12:07 amPosts: 151

Re: Code structure

A pet peeve of mine is code that ties up the processor simply waiting for a single event. I frequently write state based code using the select/case statement. This allows the overhead code to be scanned very frequently. This also allows code to be broken into very small sections with specific actions.

Fri Sep 15, 2017 9:35 pm

Ocyliptic

Rookie

Joined: Fri Mar 27, 2015 12:30 pmPosts: 2

Re: Code structure

CARBOT wrote:

A pet peeve of mine is code that ties up the processor simply waiting for a single event. I frequently write state based code using the select/case statement. This allows the overhead code to be scanned very frequently. This also allows code to be broken into very small sections with specific actions.

How do you tell the code to discriminate between significant actions and insignificant actions in a given loop?

Mon Sep 18, 2017 8:33 pm

Elohira

Rookie

Joined: Thu Jun 09, 2016 1:39 amPosts: 5

Re: Code structure

We do it both ways. If we use include files they will comprise a single function (#include autonSelectMenu.c) and we do it just to make the code more readable. Because the #include is a compiler directive, it doesn't matter during runtime, and is only for the convenience of the programmer.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum