Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3

Thread: Java to C

  1. #1
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Okay, so far I've implemented exceptions and a garbage collector. Any other ideas how I can make C more like the superior Java?
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    BTW, for those who already saw my exception library comment, here's the one for my garbage collector:
    Code:
    /**
     * Original filename: safepointers.c (created 10/29/03)
     *
     * SAFE POINTERS LIBRARY (function prefix: SP)
     *
     * This library provides crude garbage collection to properly implementing
     * programs: by registering pointers allocated using stdlib.h's memory
     * allocation functions and then later calling SP_unregisterAndFreeAll(), the
     * risk of memory leaks is effectively eliminated.
     *
     * Some words of warning, though:
     * 1. As this library relies on the Common library's "safe" memory allcoation
     *    functions, a program will immediately print an error and exit with an
     *    error code of 1 should memory allocation fail.
     *
     * 2. Memory space that is allocated using malloc(), etc. but NOT registered
     *    with this library will not be reclaimed later. Immediately after
     *    allocating the memory, register the pointer with this library.
     *
     * 3. Do NOT free the memory allocated using free() if the pointer is
     *    registered with this library. If that would take place, then attempting
     *    to free all registered pointers would result in a crash (effectively
     *    trying to "double-free" a pointer). ONLY free the pointer using SP's
     *    functions so it can be properly unregistered.
     *
     * Note that all functions except for SP_core() are merely entry points. All
     * functions other than SP_core() simply call SP_core(). See that function's
     * documentation for details.
     *
     * It's also important to note again the intention of this library: to serve as
     * a sort of garbage collector. If you know that you're going to allocate
     * memory within a function and then later free it in the same function, do so.
     * This library is only useful for data that is allocated in functions but then
     * referenced elsewhere.
     *
     * This document conforms to the ****** style guide
     * (http://*****************). When a
     * specification is not made in this style guide, NASA GSFC code 588's style
     * guide takes precedence (not available online).
     *
     * This code compiles properly in Visual C++ 6.0 SP5 and GCC 3.2.1 on Red Hat
     * Linux without warnings or errors. Use standard project settings for both
     * compilers.
     *
     * This code is documented in strict adherance to the Java documentation tool
     * "Javadoc." All documentation information required by ************is
     * included in the Javadoc tags or in the description of functions, constants,
     * etc.
     *
     * Version history:
     *   1.0.0: Initial release.
     *
     * @author Arien Talabac (***************)
     * @version 1.0.0
     */
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Originally posted by filburt1
    Any other ideas how I can make C more like the superior Java?
    Disallow multiple inheritance, eliminate pointers, and hide low-level processes... then you'll have C#


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:26 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com