typedef on Java?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: typedef on Java?

  1. #1
    Join Date
    Feb 2007
    Posts
    60

    typedef on Java?

    Peace everyOne...

    I've to import some code from C to Java , so I've some trouble with the 'typedef' :
    For Example :
    C :
    typedef MY_TYPE T_INPUT [MAX_INPUT] ; //My Type Already declared as a struct
    static T_INPUT t_input[MAX_INPUT][MAX_INPUT];


    JAVA : Any Idea ?

    Thx

  2. #2
    Join Date
    Jul 2004
    Posts
    81
    Code:
    private static MY_TYPE[][][] t_input = new MY_TYPE[MAX_INPUT][MAX_INPUT][MAX_INPUT];
    (via C++ to Java Converter)
    Last edited by David Anton; 05-25-2009 at 11:18 AM. Reason: originally posted conversion was wrong
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com
    Instant C# - VB to C# Converter
    Instant VB - C# to VB Converter

  3. #3
    Join Date
    Feb 2007
    Posts
    60
    Thx ; )

    For the typedef I just convert it into a class , I think it's the only way to make it as a Type in Java !!

    class T_INPUT{

    public T_INPUT()
    {

    S_INPUT_TYPE []T_INPUT=new S_INPUT_TYPE[MAX] ;
    }
    }

    T_INPUT [ ][ ]T_input_=new T_INPUT[MAX][MAX];


    ; )

  4. #4
    Join Date
    Mar 2007
    Location
    Bangalore, India
    Posts
    247
    If you want it as a separate type, I guess thats the way. But beware, converting between T_INPUT and MY_TYPE[] may introduce problems. It may be better to use MY_TYPE[] directly wherever required.

Similar Threads

  1. Java book
    By Lou in forum Java
    Replies: 9
    Last Post: 09-19-2007, 06:58 AM
  2. Replies: 2
    Last Post: 06-14-2006, 04:16 PM
  3. Java vs. .Net. A questionnaire
    By Basil in forum .NET
    Replies: 1
    Last Post: 05-13-2005, 07:46 AM
  4. Re: VB vs. Visual Age for Java
    By JJ in forum Enterprise
    Replies: 1
    Last Post: 07-06-2000, 05:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center