Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow non-iostream builds? #205

Closed
JodiTheTigger opened this issue Sep 28, 2015 · 10 comments
Closed

Allow non-iostream builds? #205

JodiTheTigger opened this issue Sep 28, 2015 · 10 comments

Comments

@JodiTheTigger
Copy link
Contributor

Hello,

would it be possible to make it so that I can use the format.cc/h library without it referencing any of the *stream headers/libraries?

I quickly hacked the files removing any reference to istream/ostream/sstream and it seemed to build fine (g++ 5.2.0). So it seems like an easy do.

@vitaut
Copy link
Contributor

vitaut commented Oct 1, 2015

Hi,
It should be pretty straightforward to do by conditionally compiling a few parts using iostreams, but could you give some details why you need this?

@JodiTheTigger
Copy link
Contributor Author

Just a personal hatred for the entire stream system and API, both from a performance, and a readability perspective.

Your library seems quite nice, since I'm not a fan of the printf system either. It would be a shame for it to be saddled by the streams ogre :-)

@vitaut
Copy link
Contributor

vitaut commented Oct 8, 2015

Not a big fan of IOStreams myself, but I'd rather not clutter the code with more #ifdefs if this doesn't give substantial practical benefit. The library doesn't use IOStreams internally, only provides support for user-defined types that have overloaded operator<< which is entirely optional. Conditionally compiling this part won't improve the performance, but will slightly degrade readability.

@JodiTheTigger
Copy link
Contributor Author

No problem.

If #ifdefs are too bothersome, then just put the stream functions into seperate files and make using streams (or disabling them) optional in the cmake file then.

@JodiTheTigger
Copy link
Contributor Author

Whoops, just realised you're aiming for a 2 file library, so splitting the functions into their own files wouldn't work.

Which makes me ask why you are bothered by another #if*? considering you have 38 in the header file and 15 in the cc.

Noting importance, I'm also concerned with compile time. Include a stream header in a project DOES impacts compile time (although I admit only on mechanical HDDs, I compile on an SSD and it only increases build time by 2.5%)

@JodiTheTigger
Copy link
Contributor Author

Anyway, I can do a pull request if you want.

@vitaut
Copy link
Contributor

vitaut commented Oct 9, 2015

Which makes me ask why you are bothered by another #if*? considering you have 38 in the header file and 15 in the cc.

I wish I could kill them =).

Anyway, if you feel strongly about not using iostreams, please do submit a PR.

@Spartan322
Copy link

If I'm allowed to ask, I'd like to know why the IOStreams are such a thing to worry about here, it seems close to little point in providing a removal of the streams, even if they are rather...well, eh, but is there really a benefit to doing this? (seeing as they most only provide functionality, and aren't actually used)

@vitaut
Copy link
Contributor

vitaut commented Oct 11, 2015

@Spartan322 I'm somewhat skeptical myself as to practical benefit of this. 2.5% reduction in compile time doesn't sound like a big gain.

@JodiTheTigger
Copy link
Contributor Author

Pull request as Issue #208.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants