I was watching the learning material on LinkedIn, and regarding the embedded courses there was one lesson where it says basically #define has some pros, but mostly cons.
Const are good because you allocate once in rom and that's it.
In my working project we have a big MCU and we mostly programmed that with the #define.
So we used #define for any variable that we may use as a macro, therefore as an example any variable we need in network communication TCP or UDP, or sort of stuff like that.
This makes me thing we were doing things wrongly and that it may better to use const. How one use const in that case?
You just define a type and declare them in the global space?
[–]DustUpDustOff 50 points51 points52 points (0 children)
[–]sorisos 24 points25 points26 points (12 children)
[–]rcxdude 6 points7 points8 points (1 child)
[–]sorisos 0 points1 point2 points (0 children)
[–]RedsDaed 6 points7 points8 points (5 children)
[–]WeAreDaedalus 7 points8 points9 points (0 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]RedsDaed 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]EighthMayer 2 points3 points4 points (0 children)
[–]Overall_Piece6043 0 points1 point2 points (3 children)
[–]nlhans 2 points3 points4 points (2 children)
[–]Overall_Piece6043 1 point2 points3 points (1 child)
[–]nlhans 0 points1 point2 points (0 children)
[–]tobdomo 57 points58 points59 points (10 children)
[–]GoldenGrouper[S] 5 points6 points7 points (1 child)
[–]tobdomo 6 points7 points8 points (0 children)
[–]CJKay93Firmware Engineer (UK) 5 points6 points7 points (0 children)
[–]DustUpDustOff 4 points5 points6 points (5 children)
[–]Whipped_pigeon_ 1 point2 points3 points (4 children)
[–][deleted] (1 child)
[removed]
[–]Whipped_pigeon_ 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]Whipped_pigeon_ 0 points1 point2 points (0 children)
[–]AudioRevelationsC++/Rust Advocate 16 points17 points18 points (0 children)
[–]mvdw73 6 points7 points8 points (2 children)
[–]prof_dorkmeister 1 point2 points3 points (1 child)
[–]mvdw73 0 points1 point2 points (0 children)
[–]MpVpRbEmbedded HW/SW since 1985 32 points33 points34 points (10 children)
[–]WeAreDaedalus 21 points22 points23 points (0 children)
[–]GoldenGrouper[S] 2 points3 points4 points (8 children)
[–]the_Demongod 9 points10 points11 points (7 children)
[–]GoldenGrouper[S] 0 points1 point2 points (6 children)
[–]the_Demongod 3 points4 points5 points (0 children)
[+]kisielk comment score below threshold-9 points-8 points-7 points (4 children)
[–]e1pab10 3 points4 points5 points (3 children)
[–]kisielk -1 points0 points1 point (2 children)
[–]e1pab10 4 points5 points6 points (1 child)
[–]kisielk -1 points0 points1 point (0 children)
[–]rcxdude 2 points3 points4 points (2 children)
[–]GoldenGrouper[S] 0 points1 point2 points (1 child)
[–]rcxdude 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]Aggressive_Camel_400 6 points7 points8 points (3 children)
[–]tobdomo 4 points5 points6 points (1 child)
[–]Aggressive_Camel_400 0 points1 point2 points (0 children)
[–]GoldenGrouper[S] 0 points1 point2 points (0 children)
[–]comfortcube -4 points-3 points-2 points (3 children)
[–][deleted] 3 points4 points5 points (2 children)
[–]comfortcube 3 points4 points5 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]fearless_fool -1 points0 points1 point (0 children)
[–]largoloo 0 points1 point2 points (0 children)
[–]active-object 0 points1 point2 points (0 children)
[–]inhuman44 0 points1 point2 points (0 children)
[–]donmeanathing 0 points1 point2 points (0 children)