Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Latest Newsgroups: comp.lang.c++,comp.lang.c Subject: Re: No, C is not a simple language Followup-To: comp.lang.c Date: 26 Apr 2021 10:35:03 GMT Lines: 27 Message-ID: References: X-Trace: individual.net 9hCNyEjELVUReaxf1l9MXQduhKuDnUnsLwUlJf+2GWrr+gKzK8 Cancel-Lock: sha1:WZNsANdN9xSPV6Ci6AMTD2Y8Obg= User-Agent: slrn/1.0.3 (Linux) Xref: csiph.com comp.lang.c++:79285 comp.lang.c:160352 ["Followup-To:" header set to comp.lang.c.] Juha Nieminen wrote: > In comp.lang.c++ Robert Latest wrote: >> Your argument above is based on NOT designing your data structures correctly >> in C, and now you say C++ handles better but only IF you do it correctly? >> Doesn't make sense. > > Are you telling be that every single time you create a struct in a C program > you always write a "constructor" and "destructor" for it, Of course not. > just in case that some time in the future they might start requiring them? No. Only if the data structure requires it, as is typical with nested, dynamically allocated structs. Then of course it requires only a few extra lines of code per struct type. If your struct is used for any non-trivial amount of work you'll need some init code anyway. > Well, even if you actually do, my point stands: In C++ you don't need to do > that. Then why don't you use C++ if thinking about memory management bothers you so much? -- robert