Git Product home page Git Product logo

Comments (9)

argl304 avatar argl304 commented on June 26, 2024 2

The warning GCC_WARN_UNUSED_PARAMETER could be added as well. iOS default is YES.

from xcconfigs.

diederich avatar diederich commented on June 26, 2024

Right - I just looked over the list in Xcode and there are actually quite a few which we haven't overwritten with the Default Value (maybe ~10-20%). I'm not sure we should. What's your thought on which ones to overwrite, which ones to leave the default (which comes in handy, if Apple ever changes them BTW :-))

from xcconfigs.

fabb avatar fabb commented on June 26, 2024

Personally I think it‘s nice to have all settings in xcconfigs, even when they overwrite defaults, since I can quickly find them and change them temporarily. But apart from that there‘s not much value in it. When Apple decides to change a default, it will have a good reason (if that ever happens).

from xcconfigs.

diederich avatar diederich commented on June 26, 2024

Hey @fabb, thanks for the clarification!
My workflow is actually changing overwrites in the xcodeprojects, and the xcconfigs are basically my better "Apple-defaults".
I'd suggest we leave out defaults that we don't think should be changed, and focus on the stuff we think we know better 😆

from xcconfigs.

fabb avatar fabb commented on June 26, 2024

Fine with me!

So back to GCC_WARN_UNUSED_PARAMETER: should we activate it? It might be annoying for a few unused parameters in delegate methods, but apart from that it helps to keep the code clean.

from xcconfigs.

diederich avatar diederich commented on June 26, 2024

I just enabled it here for the fun of it, and I think it does not work well together with Objective-C.
Combined with our Warnings-As-Errors, all those warnings become must-fixs. And given the parameter name often has information, it can't be removed, and commenting it with /* name */ might be too tedious?
I do remember having it enabled for my C++ projects, and using the commenting style above - but the style looks off for me in Objective-C. I can't recall having it seen it before as well.
Omitting the unused parameter names altogether looks to me even more off to me. :-)
I see those are mostly style arguments, but nevertheless, have you seen the commented / omitted Objective-C parameter names often?

from xcconfigs.

fabb avatar fabb commented on June 26, 2024

I‘m not really sure in which cases you would like to keep unused parameters at all, do you have some examples?

Fyi you can use __unused to annotate unused parameters that should not trigger the warning.

from xcconfigs.

diederich avatar diederich commented on June 26, 2024

Good call with __unused, thanks!

And sure, on the sample project I tried, I got around 300 warnings by enabling it. Here are some of them:


xxx:303:60: warning: unused parameter 'scrollView' [-Wunused-parameter]
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView {
                                                           ^
xxx:312:44: warning: unused parameter 'collectionView' [-Wunused-parameter]
- (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath
                                           ^
xxx:312:105: warning: unused parameter 'indexPath' [-Wunused-parameter]
- (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath
                                                                                                        ^
xxx:318:44: warning: unused parameter 'collectionView' [-Wunused-parameter]
- (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath
                                           ^
xxx:318:102: warning: unused parameter 'indexPath' [-Wunused-parameter]
- (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath
                                                                                                     ^
xxx:324:44: warning: unused parameter 'collectionView' [-Wunused-parameter]
- (BOOL)collectionView:(UICollectionView *)collectionView shouldDeselectItemAtIndexPath:(NSIndexPath *)indexPath

I wouldn't wanna flip this switch... :-)

from xcconfigs.

fabb avatar fabb commented on June 26, 2024

Ok, no problem.

from xcconfigs.

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.