Coder Social home page Coder Social logo

shouldn't alloca be a macro? about orangec HOT 3 CLOSED

ladsoft avatar ladsoft commented on June 1, 2024
shouldn't alloca be a macro?

from orangec.

Comments (3)

LADSoft avatar LADSoft commented on June 1, 2024

Hi Lionfaith,

I too am unsure whether to classify it as a 'bug' since alloca isn't
part of the C standard :). However, as there is a precedent for how it
is handled I've adjusted Orange C to do it the same way. Now, if you
want alloca or _alloca to be supported include "malloc.h" and it will
define them as macros.

David
lionfaith wrote:

Hello!
I'm not sure about this one. But I discovered that SDL 1.2.12, in
SDL_stdinc.h, tests the presence of alloca function with |#if
defined(HAVE_ALLOCA) && !defined(alloca)| as if alloca were a macro.
But it doesn't work with occ which doesn't see it that way. I had to
hack the header to specifically manage OrangeC case. I'm not sure if
it is really a bug though.


Reply to this email directly or view it on GitHub
#9.

from orangec.

lionfaith avatar lionfaith commented on June 1, 2024

As I can read it in SDL_stdinc.h, it is the way msvc, borland and watcom does it. (but Gnu has __builtin_alloca, digital mars puts alloca in stdlib.h, AIX asks for a #pragma alloca and MRC asks for declaration void *alloca (unsigned);). Too bad it is not standardised, at least with a standardised way of knowing if alloca is there and how to "activate" it.
Thanks for your work!

from orangec.

LADSoft avatar LADSoft commented on June 1, 2024

you're welcome. mingw/gnu actually has alloca defined as macros in malloc.h, they reference the __builtin_alloca function. I chose to do it the same way :)

from orangec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.