Message from C, C++ talks

June 2019

— There is a structure FILE in stdio.h

— Purge complete.

— We know that, what's your problem? Btw, in C++ there's far better ways to handle files

— Is it normal practice to write constructors in such way? Or it's a shitty code?

https://paste.fedoraproject.org/paste/Xn6r78NO0TQc8D7t4aWysQ

Message permanent page

— 

I don't see anything really wrong. I recommend putting as much as you can in the list initialization

— Thank you for answer. But there is a problem when using delegating constructors. It's impossible to add anything else to class members initialization list. And so I decided to mix some already defined constructors and add remaining parameters in body. Is it a good approach?

Message permanent page

— Agree with Francisco, it looks OK, but list initialization usually is a better way (especially if you have many different constructors, and want them to be consistent).

Message permanent page

— I use delegating constructors a lot. If we had Python's syntax for function arguments, it would be different

Message permanent page

— Why is it impossible? Can you give an example that doesn't compile, but should in your opinion?

— For example:
https://stackoverflow.com/questions/12190051/member-initialization-while-using-delegated-constructor/12190126

Message permanent page

— Ah, I see, I thought it's possible 😅

— Several hours ago I was too :D

— Just to say, in my projects, the default constructor depends in other constructors, not the other way around. I think of it as "there should be a delegating constructor that can do the same job as the default one but with default parameters"

Message permanent page

— Sorry, can't get it. Can you show an example? Are you using default constructor as delegating? But it has no parameters.

Message permanent page

— What you're doing is printing the pointer to the file descriptor. It not what you want probably. I'm not familiar with C-way of reading files, but maybe this will be helpful.
https://stackoverflow.com/questions/4823177/reading-a-file-character-by-character-in-c

Message permanent page