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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:20:04+00:00 2026-05-11T17:20:04+00:00

I am writing an API that updates a LOT of different fields in a

  • 0

I am writing an API that updates a LOT of different fields in a structure.

I could help the addition of future fields by making the update function variadic:

update(FIELD_NAME1, 10, FIELD_NAME2, 20);

then later add FIELD_NAME3 with out changing any existing calls:

update(FIELD_NAME1, 10, FIELD_NAME2, 20, FIELD_NAME3, 30);

words of wisdom please?

  • 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-11T17:20:04+00:00Added an answer on May 11, 2026 at 5:20 pm

    Generally, no.

    Varargs throws out a lot of type-safety – you could pass pointers, floats, etc., instead of ints and it will compile without issue. Misuse of varargs, such as omitting arguments, can introduce odd crashes due to stack corruption, or reading invalid pointers.

    For instance, the following call will compile and result in crashes or other odd behavior:

    UpdateField(6, "Field1", 7, "Field2", "Foo");
    

    The initial 6 is how many parameters to expect. It will convert the string pointer “Foo” to an int to put in Field2, and it will try to read and interpret two other parameters that aren’t present, which will probably cause a crash here from dereferencing stack noise.

    I believe the implementation of varargs in C is a mistake (given today’s environment – it probably made perfect sense in 1972.) The implementation is you pass a bunch of values on the stack and then the callee will walk the stack picking up parameters, based on its interpretation of some initial control parameter. This type of implementation basically screams for you to make a mistake in what might be a very difficult to diagnose way. C#’s implementation of this, passing an array of objects with an attribute on the method, is just must saner, albeit not directly mappable into the C language.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a simple Facebook status update web app that uses Graph API. It
Is there any API for writing a C# program that could interface with Windows
I'm writing an API on Android that will be used by an existing application,
Hey--I'm writing a basic Rails app that uses the digg API. I'm trying to
I have an application I'm writing for Windows 8/WinRT that uses the StreamSocket API
I'm currently writing a Rails 3 app that uses the google maps API (v3)
I'm writing a webapp that uses the YouTube Code API to do specific types
I'm writing a little web utility that posts status updates to Twitter and/or Facebook.
Is there a Chrome extension post install hook/API function that will let me perform
I am writing an API and have come across the following pattern: My API

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.