If you have a counter that gets incremented through multiple functions, is it better to use a global counter or pointer counter? They both work just curious which is better and why.
Jump to Post
My personal preference would be to use a global (and document it well). It's the most straightforward and simplest way. Creating a class for a simple counter or throwing pointers around helter-skelter just muddies things up. If you wanbt an analogy, purists say that you should never ever use a …
All 3 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.