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 8950295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:25:19+00:00 2026-06-15T13:25:19+00:00

A logging structure that depends on logging related functions looks like this: typedef struct

  • 0

A logging structure that depends on logging related functions looks like this:

typedef struct 
{
    TFkt_vlogf vlogf;
    TFkt_outf outf;
    void* logData;
} TLogger;

In this logging function there is an abstract logData that is assigned with different pointers depending on the job that the logger has.

A Filelogger would at one point access a stored filehandle like this.

FILE * fileHandle = (FILE *)(logger->logData);

Although this compiles SPLint is unhappy about this and complains with this message:

Cast to underlying abstract type FILE *: (FILE *)(logger->logData)

What can i do to satisfy SPLint?

  • i tried to sprinkle some /*@abstract@*/ around but it did not help

Is there a better way in C90 to store and access data while still keeping the structure signature to pass the type around independent of its implementation?

  • 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-06-15T13:25:20+00:00Added an answer on June 15, 2026 at 1:25 pm

    The better Solution is to use a union and have all possible Data inside that union.

    typedef union
    {
        FILE * fileHandle;
        char something;
        long int other;
    } TLog_data;
    
    typedef struct 
    {
        TFkt_vlogf vlogf;
        TFkt_outf outf;
        TLog_data logData;
    } TLogger;
    

    At some point during execution you would use:

    ((TLogger*) logger)->logData.fileHandle
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For logging purposes, I'd like to create a logger that automatically adds the current
I'm writing a logging function for automation unit test. html elements structure: <li> <strong>
For logging purposes, I would like to call the .ToString() method of every object
I am interested in logging all traffic that comes over port 443 for trouble-shooting
I have an adjacent list hierarchy model that makes up a topic structure ID
I'm just starting to work on a logging library that everyone can use to
I typically write my scripts with a structure like s #!/usr/bin/python import stuff def
I'm working with a legacy Java app that has no logging and just prints
The question: How can I structure my code so that the knockout bindings are
I'm working on a logging program, and I'd like to avoid processing the same

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.