GithubHelp home page GithubHelp logo

Comments (5)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
Hi agladysh,

I'm not so sure about this. It's definitely intended behaviour that it 
*doesn't* stop on the first error, because otherwise a single typo in a config 
file would ruin the whole thing. Though if you do want this behaviour, you can 
just have your program bomb out if ini_parse() returns nonzero?

However, if you could give me more specifics about your use case and why this 
approach wouldn't work -- I'd be interested in hearing more.

Thanks,
Ben.

Original comment by [email protected] on 25 Sep 2010 at 1:05

from inih.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
Hi, Ben!

I often *want* single typo to ruin the whole thing! Strict mode is at least as 
useful as fault-tolerant — for different tasks of course.

I can bomb out afterwards, no problem. In item 1 I was talking about not 
parsing whole config if I only want to read a couple of values from it. Same 
reasoning as you wrote in your blog entry: "you don’t have to load the whole 
file into memory if you don’t need to" — "you don't have to parse whole 
file if you don't need to".

But more critical for me is item 2. See this practical example from my Lua 
binding to your library:

http://github.com/agladysh/lua-inih/blob/v0.1/src/lua-inih.c#L32-37

I don't want to accumulate errors here (error cames from the Lua callback) — 
it will seriously complicate implementation. I want to bail out on first error 
and be done with it. Currently I have to rely on indirect checks to know if 
we've failed already and want to preserve original error message. If I could 
just return <stop right now> from the callback, life would be much simpler.

Thanks,
Alexander.

P.S. By the way, thank you for this useful library! :-)

Original comment by [email protected] on 25 Sep 2010 at 5:20

from inih.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
Anyway, even if you don't want to change current behaviour, please explicitly 
document it.

Original comment by [email protected] on 25 Sep 2010 at 5:22

from inih.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
Yes, this one I'd rather not implement, but I have added a comment making it 
more explicit in ini.h.

My main reason to keep it as is is to keep it simple -- when would it stop? on 
first "critical error", or only on first time callback returned error.

However, I'd consider adding a STOPONFIRSTERROR flag in ini.h (like the 
MULTILINE one) if you come up with good reasoning to determine on which errors 
it should stop etc.

Original comment by [email protected] on 27 Sep 2010 at 2:15

from inih.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 17, 2024
WontFix, as per my above comment.

Original comment by [email protected] on 16 Dec 2010 at 2:30

  • Changed state: WontFix

from inih.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.