Here's a quick and dirty example of how this function could be rewritten with modern C++. I omitted some necessary details, particularly the implementation of the linked list iterator. I also wrote it out quickly so I can't be certain it's 100% correct, but it should give you an idea of whats possible.
// I assume you meant to return a pointer template<typename Iter> auto test_funct(Iter iter, Iter end, char opt) { for (; iter != end; ++iter) { // dereferencing iter would get buff if (!*iter) { *iter = opt; break; } } return iter; } I also made an example using the C++ algorithms library. template<typename Iter> auto test_funct(Iter begin, Iter end, char opt) { auto iter = std::find_if(begin, end, [](auto buff){return !buff;}); if (iter) { *iter = opt; } return iter; } As I said, there's quite a bit omitted here, to be blunt, implementing both the fancy pointers (especially when I don't know anything about the hardware) and the iterators required would be more of a task than I am willing to do. I'm happy to help but I don't think I should be doing unpaid labor :). These examples would work with anything implementing the C++ iterator interface, as long as you conform to that interface on both sides, most code will be reusable where it is possible. Regarding the C++ runtime, I can't speak authoritatively, but I believe that the C++ runtime is fairly hefty yes. Luckily, plenty of the standard library does not require it. I believe you'll want to look into GCC's freestanding support to get a full picture of what is and is not available. Again, I can't speak authoritatively on the matter, but I think you would be correct to avoid the C++ runtime. There are other pitfalls to beware of, one of my concerns is that templates can cause some degree of bloat to executable size, I imagine one can get around it if they try hard enough though. The most real bottleneck you'll encounter in very large projects is compile time, but that all depends on what you're using, and how much you're using it, and even then there are mitigations for that. I'm happy to answer more questions and help, however I'm concerned this is getting fairly unrelated to GCC. -Alex