Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6673743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:39:48+00:00 2026-05-26T03:39:48+00:00

A basic question I fear. The following code works, and the typedef enumeration is

  • 0

A basic question I fear. The following code works, and the typedef enumeration is recognised, but I get a warning message “useless storage class specifier in empty declaration”. Am I doing something wrong here and is this the best place to put a typedef enum?

#import <UIKit/UIKit.h>
#import "CoreDataBaseTableViewController.h"

typedef enum ColourType {
    BACKGROUND=1,
    LOW=2,
    HIGH=3,
    EXTRA=4
};

@interface ColourList : CoreDataBaseTableViewController <NSFetchedResultsControllerDelegate> {

    NSManagedObjectContext* moc;    
    NSFetchedResultsController* fetchedResultsController; 

    ...

    enum ColourType colourTarget;

}

...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:39:49+00:00Added an answer on May 26, 2026 at 3:39 am

    You can put an enumeration anywhere in Objective-C which is valid in C. Where you have it now (above the interface) is a common place for enumerations which should be globally available. The warning is because you are using typedef, but don’t actually define a type. If you simply want to create an enumeration, it isn’t necessary. You just use:

    enum ColourType {
        BACKGROUND=1,
        LOW=2,
        HIGH=3,
        EXTRA=4
    };
    

    You use typedef to define a type, which makes it easier to reference commonly used structures/unions/enumerations/other types. If you choose to do this, you should place a name for the type after the enumeration definition, and then you can reference the enumeration by using that name without the enum keyword.

    typedef enum ColourType {
        BACKGROUND=1,
        LOW=2,
        HIGH=3,
        EXTRA=4
    } MyColourType;
    MyColourType colour;
    

    Alternatively, you can create the enumeration and type in separate commands with the same effect.

    enum ColourType {
        BACKGROUND=1,
        LOW=2,
        HIGH=3,
        EXTRA=4
    };
    typedef enum ColourType MyColourType;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a basic question, I fear. Take a look at the following code.
basic question, but I'm unsure. Not looking for code as an answer. I want
Basic question but I've searched and can't quite get this nailed - how can
Very basic question - but I couldn't find an answer. I have got a
Very basic question - how to get one value from a generator in Python?
Basic question; I have this code: var partipiansRow = '<div class=form-row ><input type=text id=name
Basic question, but I can't figure it out...I have a label with an accelerator
Basic question about the way git works. I clone a repo, make some changes,
Basic question, but I can't find a simple answer anywhere. What is the best
A basic question please, I am trying this code: var number_questions = postsJSON1[i]['question'].length; for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.