IP Library Granted Patent US 8,689,195
Granted Patent B2
US 8,689,195 · App. 12/131,972 · Granted Apr 1, 2014

Identifying structured data types as requiring designated initializers

Inventor: Joshua A. Triplett (Hillsboro, OR)
Assignee: International Business Machines Corporation
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 8,689,195
App. No.
12/131,972
Granted
Apr 1, 2014
Kind
B2
Abstract

A technique for enforcing the use of designated initializers in structured type initializations may include determining whether structured data type requires designated initialization, determining whether an initialization of a structured variable declared to use the structured data type employs an improper initializer that is inconsistent with said structured data type, and performing a diagnostic action if the initialization comprises an improper initializer.

Claims (45)

1. A machine-implemented method for enforcing the use of designated initializers in structured data type initializations, comprising:

determining whether a structured data type requires a designated initializer;

said determining being performing by either:

evaluating a structured data type definition for the presence of a syntax specifying that said structured data type requires designated initialization; or

accessing an information resource comprising an indication whether said structured data type requires designated initialization;

parsing an initialization of a structured variable declared to use said structured data type to determine whether said initialization employs an improper initializer that is inconsistent with said structured data type; and

performing a diagnostic action if said initialization comprises an improper initializer.

2. A method in accordance with claim 1 , wherein if evaluating said structured data type definition for the presence of a syntax, said structured data type is defined using a designated initializer attribute in said syntax, and wherein determining whether said structured data type requires designated initialization comprises identifying said attribute.

3. A method in accordance with claim 2 , wherein said designated initializer attribute is individually associated with one or more elements of said structured data type definition.

4. A method in accordance with claim 1 , wherein if accessing an information resource, said information resource comprising a portion of source code that contains said initialization, or resources of a project that utilizes said source code, or a language processor that processes said source code.

5. A method in accordance with claim 1 , further including providing the ability to selectively disable enforcement of the use of designated initializers.

6. A system for enforcing the use of designated initializers in structured data type initializations, comprising:

one or more processors;

a memory coupled to said one or more processors, said memory including a computer useable medium tangibly embodying at least one program of instructions executable by said processor to perform operations, comprising:

determining whether a structured data type requires a designated initializer;

said determining being performing by either:

evaluating a structured data type definition for the presence of a syntax specifying that said structured data type requires designated initialization; or

accessing an information resource comprising an indication whether said structured data type requires designated initialization;

parsing an initialization of a structured variable declared to use said structured data type to determine whether said initialization employs an improper initializer that is inconsistent with said structured data type; and

performing a diagnostic action if said structured variable initialization comprises an improper initializer.

7. A system in accordance with claim 6 , wherein if evaluating said structured data type definition for the presence of a syntax, said structured data type is defined using a designated initializer attribute in said syntax, and wherein determining whether said structured data type requires designated initialization comprises identifying said attribute.

8. A system in accordance with claim 7 , wherein said designated initializer attribute is individually associated with one or more elements of said structure data type definition.

9. A system in accordance with claim 6 , wherein if accessing an information resource, said information resource comprising a portion of source code that contains said initialization, or resources of a project that utilizes said source code, or a language processor that processes said source code.

10. A system in accordance with claim 6 , wherein said operations further comprise providing the ability to selectively disable enforcement of the use of designated initializers.

11. A computer program product for enforcing the use of designated initializers in structured type declarations, comprising:

one or more machine-useable non-transitory media;

logic provided by said one or more media for programming a data processing platform to operate as by:

determining whether a structured data type requires a designated initializer;

said determining being performing by either:

evaluating a structured data type definition for the presence of a syntax specifying that said structured data type requires designated initialization; or

accessing an information resource comprising an indication whether said structured data type requires designated initialization;

parsing an initialization of a structured variable declared to use said structured data type to determine whether said initialization employs an improper initializer that is inconsistent with said structured data type; and

performing a diagnostic action if said structured variable initialization comprises an improper initializer.

12. A computer program product in accordance with claim 11 , wherein if evaluating said structured data type definition for the presence of a syntax, said structured data type is defined using a designated initializer attribute in said syntax, and wherein determining whether said structured data type requires designated initialization comprises identifying said attribute.

13. A computer program product in accordance with claim 12 , wherein said designated initializer attribute is individually associated with one or more elements of said structure data type definition.

14. A computer program product in accordance with claim 11 , wherein if accessing an information resource, said information resource comprising a portion of source code that contains said initialization, or resources of a project that utilizes said source code, or a language processor that processes said source code.

15. A computer program product in accordance with claim 11 , wherein said logic provided by said one or more media are for programming a data processing platform to further operate by providing the ability to selectively disable enforcement of the use of designated initializers.

16. A method for enforcing the use of designated initializers in structured type declarations, comprising:

accessing source code comprising a definition for a structured data type; determining whether said structured data type requires designated initialization;

accessing source code comprising an initialization of a structured variable conforming to said structured data type;

parsing said structured variable initialization;

performing a diagnostic action if said structured variable initialization comprises an improper initializer;

said structured data type definition using a syntax for specifying that said structured data type requires designated initialization, and wherein determining whether said structured data type requires designated initialization comprises evaluating said syntax;

said syntax including a designated initializer attribute associated with said structured data type definition or with one or more elements of said structure data type definition.

17. A method in accordance with claim 16 , further including providing the ability to selectively disable enforcement of the use of designated initializers.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 3, 2008
From: TRIPLETT, JOSHUA A.
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 021032/0709 →
Continuity (1)
Related Publication 20090300581A1 · Dec 3, 2009