Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #146432 > unrolled thread
| Started by | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| First post | 2019-09-30 14:02 +0200 |
| Last post | 2019-10-05 14:08 -0700 |
| Articles | 20 on this page of 109 — 21 participants |
Back to article view | Back to comp.lang.c
alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-30 14:02 +0200
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-30 16:09 +0200
Re: alloca()-support Bo Persson <bo@bo-persson.se> - 2019-09-30 17:29 +0200
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-30 17:33 +0200
Re: alloca()-support Anton Shepelev <anton.txt@g{oogle}mail.com> - 2019-09-30 17:12 +0300
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-30 16:16 +0200
Re: alloca()-support Anton Shepelev <anton.txt@g{oogle}mail.com> - 2019-09-30 17:30 +0300
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-30 16:44 +0200
Re: alloca()-support Anton Shepelev <anton.txt@gmail.com> - 2019-10-02 00:36 +0300
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-02 06:28 +0200
Re: alloca()-support Anton Shepelev <anton.txt@gmail.com> - 2019-10-02 16:08 +0300
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-02 15:42 +0200
Re: alloca()-support scott@slp53.sl.home (Scott Lurndal) - 2019-09-30 14:30 +0000
Re: alloca()-support Anton Shepelev <anton.txt@g{oogle}mail.com> - 2019-09-30 17:33 +0300
Re: alloca()-support David Brown <david.brown@hesbynett.no> - 2019-09-30 16:56 +0200
Re: alloca()-support Melzzzzz <Melzzzzz@zzzzz.com> - 2019-09-30 15:29 +0000
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-30 17:31 +0200
Re: alloca()-support Melzzzzz <Melzzzzz@zzzzz.com> - 2019-10-01 07:03 +0000
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-01 10:57 +0200
Re: alloca()-support Melzzzzz <Melzzzzz@zzzzz.com> - 2019-10-01 18:49 +0000
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-01 21:20 +0200
Re: alloca()-support scott@slp53.sl.home (Scott Lurndal) - 2019-10-01 20:39 +0000
Re: alloca()-support Melzzzzz <Melzzzzz@zzzzz.com> - 2019-10-02 04:15 +0000
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-02 06:28 +0200
Re: alloca()-support Melzzzzz <Melzzzzz@zzzzz.com> - 2019-10-02 04:29 +0000
Re: alloca()-support Keith Thompson <kst-u@mib.org> - 2019-09-30 11:14 -0700
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-30 18:04 +0200
Re: alloca()-support William Ahern <william@25thandClement.com> - 2019-09-30 11:01 -0700
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-01 07:19 +0200
Re: alloca()-support Paavo Helde <myfirstname@osa.pri.ee> - 2019-09-30 22:26 +0300
Re: alloca()-support scott@slp53.sl.home (Scott Lurndal) - 2019-09-30 19:46 +0000
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-01 07:32 +0200
Re: alloca()-support Paavo Helde <myfirstname@osa.pri.ee> - 2019-10-01 09:08 +0300
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-01 08:35 +0200
Re: alloca()-support gazelle@shell.xmission.com (Kenny McCormack) - 2019-09-30 16:26 +0000
Re: alloca()-support Soviet_Mario <SovietMario@CCCP.MIR> - 2019-09-30 18:48 +0200
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-30 18:51 +0200
Re: alloca()-support Soviet_Mario <SovietMario@CCCP.MIR> - 2019-09-30 18:55 +0200
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-30 18:58 +0200
Re: alloca()-support Soviet_Mario <SovietMario@CCCP.MIR> - 2019-09-30 19:53 +0200
Re: alloca()-support Keith Thompson <kst-u@mib.org> - 2019-09-30 11:13 -0700
Re: alloca()-support Tim Rentsch <tr.17687@z991.linuxsc.com> - 2019-10-06 06:16 -0700
Re: alloca()-support Anton Shepelev <anton.txt@gmail.com> - 2019-10-06 16:22 +0300
Re: alloca()-support Keith Thompson <kst-u@mib.org> - 2019-10-06 12:58 -0700
Re: alloca()-support "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-10-06 13:16 -0700
Re: alloca()-support scott@slp53.sl.home (Scott Lurndal) - 2019-09-30 19:38 +0000
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-01 07:41 +0200
Re: alloca()-support scott@slp53.sl.home (Scott Lurndal) - 2019-10-01 15:19 +0000
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-01 17:31 +0200
Re: alloca()-support Melzzzzz <Melzzzzz@zzzzz.com> - 2019-10-01 18:58 +0000
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-01 21:24 +0200
Re: alloca()-support Melzzzzz <Melzzzzz@zzzzz.com> - 2019-10-02 04:28 +0000
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-02 06:30 +0200
Re: alloca()-support Melzzzzz <Melzzzzz@zzzzz.com> - 2019-10-02 04:36 +0000
Re: alloca()-support David Brown <david.brown@hesbynett.no> - 2019-10-02 10:01 +0200
Re: alloca()-support Melzzzzz <Melzzzzz@zzzzz.com> - 2019-10-02 04:42 +0000
Re: alloca()-support David Brown <david.brown@hesbynett.no> - 2019-10-02 10:10 +0200
Re: alloca()-support Mel <mel@zzzzz.com> - 2019-10-02 15:13 +0200
Re: alloca()-support David Brown <david.brown@hesbynett.no> - 2019-10-01 21:10 +0200
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-01 21:25 +0200
Re: alloca()-support scott@slp53.sl.home (Scott Lurndal) - 2019-10-01 20:44 +0000
Re: alloca()-support David Brown <david.brown@hesbynett.no> - 2019-10-01 23:26 +0200
Re: alloca()-support Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2019-10-01 21:08 -0600
Re: alloca()-support David Brown <david.brown@hesbynett.no> - 2019-10-02 10:19 +0200
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-02 06:39 +0200
Re: alloca()-support David Brown <david.brown@hesbynett.no> - 2019-10-02 10:34 +0200
Re: alloca()-support Mel <mel@zzzzz.com> - 2019-10-02 15:14 +0200
Re: alloca()-support Mel <mel@zzzzz.com> - 2019-10-02 15:18 +0200
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-02 15:21 +0200
Re: alloca()-support Melzzzzz <Melzzzzz@zzzzz.com> - 2019-10-03 04:09 +0000
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-03 07:48 +0200
Re: alloca()-support Melzzzzz <Melzzzzz@zzzzz.com> - 2019-10-03 05:49 +0000
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-03 07:52 +0200
Re: alloca()-support Melzzzzz <Melzzzzz@zzzzz.com> - 2019-10-03 06:46 +0000
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-03 10:59 +0200
Re: alloca()-support Soviet_Mario <SovietMario@CCCP.MIR> - 2019-10-03 13:39 +0200
Re: alloca()-support scott@slp53.sl.home (Scott Lurndal) - 2019-10-03 13:23 +0000
Re: alloca()-support David Brown <david.brown@hesbynett.no> - 2019-10-03 15:38 +0200
Re: alloca()-support scott@slp53.sl.home (Scott Lurndal) - 2019-10-03 14:51 +0000
Re: alloca()-support David Brown <david.brown@hesbynett.no> - 2019-10-04 09:49 +0200
Re: alloca()-support Soviet_Mario <SovietMario@CCCP.MIR> - 2019-10-03 21:47 +0200
Re: alloca()-support David Brown <david.brown@hesbynett.no> - 2019-10-04 09:53 +0200
Re: alloca()-support Soviet_Mario <SovietMario@CCCP.MIR> - 2019-10-03 21:52 +0200
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-01 07:39 +0200
Re: alloca()-support James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-09-30 21:36 -0400
Re: alloca()-support Philipp Klaus Krause <pkk@spth.de> - 2019-09-30 19:14 +0200
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-30 19:16 +0200
Re: alloca()-support Robert Wessel <robertwessel2@yahoo.com> - 2019-10-01 00:18 -0500
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-01 07:43 +0200
Re: alloca()-support Keith Thompson <kst-u@mib.org> - 2019-10-01 02:42 -0700
Re: alloca()-support James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-10-01 08:11 -0400
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-10-01 14:53 +0200
Re: alloca()-support scott@slp53.sl.home (Scott Lurndal) - 2019-09-30 17:52 +0000
Re: alloca()-support Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2019-09-30 11:20 -0600
Re: alloca()-support Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-30 19:42 +0200
Re: alloca()-support Soviet_Mario <SovietMario@CCCP.MIR> - 2019-09-30 20:02 +0200
Re: alloca()-support Soviet_Mario <SovietMario@CCCP.MIR> - 2019-09-30 19:54 +0200
Re: alloca()-support Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2019-09-30 14:28 -0600
Re: alloca()-support David Brown <david.brown@hesbynett.no> - 2019-10-01 09:38 +0200
Re: alloca()-support Soviet_Mario <SovietMario@CCCP.MIR> - 2019-09-30 20:01 +0200
Re: alloca()-support Manfred <noname@add.invalid> - 2019-10-01 17:45 +0200
Re: alloca()-support "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-10-02 02:35 -0700
Re: alloca()-support Anton Shepelev <anton.txt@gmail.com> - 2019-10-02 16:26 +0300
Re: alloca()-support jadill33@gmail.com - 2019-10-02 08:00 -0700
Re: alloca()-support Anton Shepelev <anton.txt@gmail.com> - 2019-10-03 02:38 +0300
Re: alloca()-support jadill33@gmail.com - 2019-10-03 08:42 -0700
Re: alloca()-support "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-10-02 12:33 -0700
Re: alloca()-support Anton Shepelev <anton.txt@gmail.com> - 2019-10-03 01:47 +0300
Re: alloca()-support "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-10-05 14:08 -0700
Page 1 of 6 [1] 2 3 4 5 6 Next page →
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2019-09-30 14:02 +0200 |
| Subject | alloca()-support |
| Message-ID | <qmsqs0$472$1@news.albasani.net> |
I know alloca() neither is an official part of the C nor C++ program- ming-language. But I use it for performance-reasons. Can anyone name compilers that don't support alloca()?
[toc] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2019-09-30 16:09 +0200 |
| Message-ID | <qmt2ae$kd8$1@news.albasani.net> |
| In reply to | #146432 |
>> I know alloca() neither is an official part of the C nor C++ program- >> ming-language. But I use it for performance-reasons. Can anyone name >> compilers that don't support alloca()? > I'm curious, can you give an example of where you'd use this? At a point where I did know I needed only a small variable sized array of pointers.
[toc] | [prev] | [next] | [standalone]
| From | Bo Persson <bo@bo-persson.se> |
|---|---|
| Date | 2019-09-30 17:29 +0200 |
| Message-ID | <gvelavFd30lU1@mid.individual.net> |
| In reply to | #146433 |
On 2019-09-30 at 16:09, Bonita Montero wrote:
>>> I know alloca() neither is an official part of the C nor C++ program-
>>> ming-language. But I use it for performance-reasons. Can anyone name
>>> compilers that don't support alloca()?
>
>> I'm curious, can you give an example of where you'd use this?
>
> At a point where I did know I needed only a small variable sized array
> of pointers.
>
If it is a *very* small number, you might of course always allocate the
upper limit (like 10), and just use the 5-7 needed by a specific invocation.
If the upper limit is significantly larger, the stack usage might make
alloca() less than 100% portable anyway.
Bo Persson
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2019-09-30 17:33 +0200 |
| Message-ID | <qmt790$hpo$2@news.albasani.net> |
| In reply to | #146442 |
> If it is a *very* small number, you might of course always allocate > the upper limit (like 10), and just use the 5-7 needed by a specific > invocation. No, the limit is higher, at most about 100 pointers. > If the upper limit is significantly larger, the stack usage might > make alloca() less than 100% portable anyway. The code I write is not for Arduinos.
[toc] | [prev] | [next] | [standalone]
| From | Anton Shepelev <anton.txt@g{oogle}mail.com> |
|---|---|
| Date | 2019-09-30 17:12 +0300 |
| Message-ID | <20190930171240.6a3b2042da6b4a674cbbe1c4@g{oogle}mail.com> |
| In reply to | #146432 |
Bonita Montero: >I know alloca() neither is an official part of the C nor >C++ programming-language. But I use it for performance- >reasons. Can anyone name compilers that don't support >alloca()? At least, it is absent from TCC, but the specific compilers are of no importance. The problem is that code with `alloca()' is no longer starndard C and depends on specific compilers, which harms the freedom of the users of your code to compile it with *any* C compiler. Are the benefits of `alloca(I)' worth it? Is not there a reasonably simple solution within standard C, such as an array, a variable- length array, or a pre-allocated memory block on the heap? -- () ascii ribbon campaign - against html e-mail /\ http://preview.tinyurl.com/qcy6mjc [archived]
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2019-09-30 16:16 +0200 |
| Message-ID | <qmt2nc$j03$1@news.albasani.net> |
| In reply to | #146434 |
> At least, it is absent from TCC, but the specific compilers > are of no importance. The problem is that code with > `alloca()' is no longer starndard C and depends on specific > compilers, which harms the freedom of the users of your code > to compile it with *any* C compiler. Depending on the set of compilers that support alloca() this doesn't count. And usually you have dependencies on functions becond those of standard-C/C++ anyway. > Are the benefits of `alloca(I)' worth it? Yes, alloca() is fast. > Is not there a reasonably simple solution within standard C, > such as an array, a variable-length array, or a pre-allocated > memory block on the heap? VLAs aren't part of C++ and heap-allocations haver a magnitude higher cost.
[toc] | [prev] | [next] | [standalone]
| From | Anton Shepelev <anton.txt@g{oogle}mail.com> |
|---|---|
| Date | 2019-09-30 17:30 +0300 |
| Message-ID | <20190930173034.3df5614d883fd84782885e14@g{oogle}mail.com> |
| In reply to | #146435 |
Bonita Montero: >Depending on the set of compilers that support `alloca()' >this doesn't count. I disagree. It is a difference between standard code and compiler-dependent code. You are forcing users to use specific compilers, regardless of how large a subset it is. >And usually you have dependencies on functions becond those >of standard-C/C++ anyway. Those dependencies are available as C code or libraries, whereas `alloca()' is not and cannot be. >>Are the benefits of `alloca(I)' worth it? > >Yes, alloca() is fast. I didn't say it wasn't, but suggested that you consider a fast solution in standard C. By the way, have you made certain that dynamic memory allocation would be the bottleneck of your algorithm? >>Is not there a reasonably simple solution within standard >>C, such as an array, a variable-length array, or a pre- >>allocated memory block on the heap? > >VLAs aren't part of C++ -> You have written to comp.lang.c too. >-> and heap-allocations haver a magnitude higher cost. I proposed to reuse the same heap block in many invocations of your functions. Sometimes it is possibe. -- () ascii ribbon campaign - against html e-mail /\ http://preview.tinyurl.com/qcy6mjc [archived]
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2019-09-30 16:44 +0200 |
| Message-ID | <qmt4d9$eu3$1@news.albasani.net> |
| In reply to | #146437 |
>> Depending on the set of compilers that support `alloca()' >> this doesn't count. > I disagree. It is a difference between standard code and > compiler-dependent code. You are forcing users to use > specific compilers, regardless of how large a subset it is. Most programs use platform-specific means; that's rarely an issue. >> And usually you have dependencies on functions becond >> those of standard-C/C++ anyway. > Those dependencies are available as C code or libraries, > whereas `alloca()' is not and cannot be. I only wanted to give an example that you often depend not only on C or C++. And alloca() is only one of this examples. > I didn't say it wasn't, but suggested that you consider a > fast solution in standard C. I need it in C++. But the genral issue applies for both C and C++. So I posted it in both newsgroups. >> VLAs aren't part of C++ -> > You have written to comp.lang.c too. I don't want to discuss VLAs but alloca().
[toc] | [prev] | [next] | [standalone]
| From | Anton Shepelev <anton.txt@gmail.com> |
|---|---|
| Date | 2019-10-02 00:36 +0300 |
| Message-ID | <20191002003611.040e43b8d7c376cd2d57531e@gmail.com> |
| In reply to | #146439 |
Bonita Montero to Anton Shepelev: > > > Depending on the set of compilers that support > > > `alloca()' this doesn't count. > > > > I disagree. It is a difference between standard code > > and compiler-dependent code. You are forcing users to > > use specific compilers, regardless of how large a subset > > it is. > > Most programs use platform-specific means; that's rarely > an issue. Platform-specific facilities, indeed, are not an issue because they come with the platform. Some are even standartised (POSIX), so that general-purpose software can often be written in largely a platform-independent manner, e.g. the NetPBM suite and the dcraw developer. Other programs can be ported to new platform by supplying custom implementations of the platform-specific functions that they use. But `alloca()' is not a platform-pecific facility, because it may exist or be absent on the majority of platforms. Nor is it a normal, suppliable, dependency because one cannot simply implement it whenever needed. -- () ascii ribbon campaign -- against html e-mail /\ http://preview.tinyurl.com/qcy6mjc [archived]
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2019-10-02 06:28 +0200 |
| Message-ID | <qn190t$hai$1@news.albasani.net> |
| In reply to | #146510 |
> But `alloca()' is not a platform-pecific facility, because > it may exist or be absent on the majority of platforms. .. Doesn't matter, almost any compiler supports it.
[toc] | [prev] | [next] | [standalone]
| From | Anton Shepelev <anton.txt@gmail.com> |
|---|---|
| Date | 2019-10-02 16:08 +0300 |
| Message-ID | <20191002160845.fca7292f8ba454c7d4bf3815@gmail.com> |
| In reply to | #146513 |
Bonita Montero to Anton Shepelev: > > But `alloca()' is not a platform-pecific facility, > > because it may exist or be absent on the majority of > > platforms. .. > > Doesn't matter, almost any compiler supports it. An approach such as yours may lead to the unjustified discrimination of any compiler that does not implement one or another non-standard function that many other compilers have implemented. -- () ascii ribbon campaign -- against html e-mail /\ http://preview.tinyurl.com/qcy6mjc [archived]
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2019-10-02 15:42 +0200 |
| Message-ID | <qn29gl$723$1@news.albasani.net> |
| In reply to | #146530 |
>> Doesn't matter, almost any compiler supports it. > An approach such as yours may lead to the unjustified > discrimination of any compiler that does not implement one > or another non-standard function that many other compilers > have implemented. That's ok if these compilers don't implement common convenience -functions.
[toc] | [prev] | [next] | [standalone]
| From | scott@slp53.sl.home (Scott Lurndal) |
|---|---|
| Date | 2019-09-30 14:30 +0000 |
| Message-ID | <%jokF.7409$1o3.5576@fx09.iad> |
| In reply to | #146434 |
Anton Shepelev <anton.txt@g{oogle}mail.com> writes:
>Bonita Montero:
>
>>I know alloca() neither is an official part of the C nor
>>C++ programming-language. But I use it for performance-
>>reasons. Can anyone name compilers that don't support
>>alloca()?
>
> [snip]
> The problem is that code with
>`alloca()' is no longer starndard C and depends on specific
>compilers, which harms the freedom of the users of your code
>to compile it with *any* C compiler.
Good grief. 90% of all C code isn't open source and the programmer
is free to use whatever features necessary for the program to
function as required.
And, FWIW, alloca() has never been "starndard" C.
[toc] | [prev] | [next] | [standalone]
| From | Anton Shepelev <anton.txt@g{oogle}mail.com> |
|---|---|
| Date | 2019-09-30 17:33 +0300 |
| Message-ID | <20190930173350.7bb03e282c61cc1b4165b8e2@g{oogle}mail.com> |
| In reply to | #146436 |
Scott Lurndal to Anton Shepelev: >>The problem is that code with `alloca()' is no longer >>starndard C and depends on specific compilers, which harms >>the freedom of the users of your code to compile it with >>*any* C compiler. > >Good grief. 90% of all C code isn't open source and the >programmer is free to use whatever features necessary for >the program to function as required. Reliance on compiler features puts the same fetters on free and commerical code. >And, FWIW, alloca() has never been "starndard" C. You misunderstood my usage of "no longer". I meant that once you start using alloca() your program is no longer standard C. -- () ascii ribbon campaign - against html e-mail /\ http://preview.tinyurl.com/qcy6mjc [archived]
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2019-09-30 16:56 +0200 |
| Message-ID | <qmt52v$h2a$1@dont-email.me> |
| In reply to | #146438 |
On 30/09/2019 16:33, Anton Shepelev wrote: > Scott Lurndal to Anton Shepelev: > >>> The problem is that code with `alloca()' is no longer >>> starndard C and depends on specific compilers, which harms >>> the freedom of the users of your code to compile it with >>> *any* C compiler. >> >> Good grief. 90% of all C code isn't open source and the >> programmer is free to use whatever features necessary for >> the program to function as required. > > Reliance on compiler features puts the same fetters on free > and commerical code. The great majority of C and C++ programs are dependent on features that are limited to specific target processors, compilers, and/or OS's. Some programs are written in a way to minimise these dependencies, or at least to isolate them in a small number of files. For many other programs, it really doesn't matter - the code will only be used with one compiler or on one target. And some features are non-standard but found on many compilers - alloca() is one of these. If you are using a serious compiler, it will support alloca(). Your alloca() code might not work on a tiny microcontroller, or on a toy compiler like TCC, but it is highly likely that a lot more of the code will have trouble there too. > >> And, FWIW, alloca() has never been "starndard" C. > > You misunderstood my usage of "no longer". I meant that > once you start using alloca() your program is no longer > standard C. > It is, I believe, extremely unlikely that use of alloca() will be the deciding factor for which compilers can be used with the code.
[toc] | [prev] | [next] | [standalone]
| From | Melzzzzz <Melzzzzz@zzzzz.com> |
|---|---|
| Date | 2019-09-30 15:29 +0000 |
| Message-ID | <5bpkF.362985$665.162605@fx28.am4> |
| In reply to | #146434 |
On 2019-09-30, Anton Shepelev <anton.txt@g{oogle}mail.com> wrote:
> Bonita Montero:
>
>>I know alloca() neither is an official part of the C nor
>>C++ programming-language. But I use it for performance-
>>reasons. Can anyone name compilers that don't support
>>alloca()?
>
> At least, it is absent from TCC, but the specific compilers
> are of no importance. The problem is that code with
> `alloca()' is no longer starndard C and depends on specific
> compilers, which harms the freedom of the users of your code
> to compile it with *any* C compiler. Are the benefits of
> `alloca(I)' worth it? Is not there a reasonably simple
> solution within standard C, such as an array, a variable-
> length array, or a pre-allocated memory block on the heap?
VLA elliminates need for alloca...
>
--
press any key to continue or any other to quit...
U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec
Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi
bili naoruzani. -- Mladen Gogala
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2019-09-30 17:31 +0200 |
| Message-ID | <qmt757$hpo$1@news.albasani.net> |
| In reply to | #146441 |
Am 30.09.2019 um 17:29 schrieb Melzzzzz: >>> I know alloca() neither is an official part of the C nor >>> C++ programming-language. But I use it for performance- >>> reasons. Can anyone name compilers that don't support >>> alloca()? >> At least, it is absent from TCC, but the specific compilers >> are of no importance. The problem is that code with >> `alloca()' is no longer starndard C and depends on specific >> compilers, which harms the freedom of the users of your code >> to compile it with *any* C compiler. Are the benefits of >> `alloca(I)' worth it? Is not there a reasonably simple >> solution within standard C, such as an array, a variable- >> length array, or a pre-allocated memory block on the heap? > VLA elliminates need for alloca... C++ hasn't VLAs. I only want to discuss this issue in both groups as this is a special compiler-specific problem. A compiler that supports C++ also usually compiles C-code. And if it supports alloca() it supports it in both languages.
[toc] | [prev] | [next] | [standalone]
| From | Melzzzzz <Melzzzzz@zzzzz.com> |
|---|---|
| Date | 2019-10-01 07:03 +0000 |
| Message-ID | <3TCkF.534719$R83.27039@fx23.am4> |
| In reply to | #146443 |
On 2019-09-30, Bonita Montero <Bonita.Montero@gmail.com> wrote: > Am 30.09.2019 um 17:29 schrieb Melzzzzz: >>>> I know alloca() neither is an official part of the C nor >>>> C++ programming-language. But I use it for performance- >>>> reasons. Can anyone name compilers that don't support >>>> alloca()? > >>> At least, it is absent from TCC, but the specific compilers >>> are of no importance. The problem is that code with >>> `alloca()' is no longer starndard C and depends on specific >>> compilers, which harms the freedom of the users of your code >>> to compile it with *any* C compiler. Are the benefits of >>> `alloca(I)' worth it? Is not there a reasonably simple >>> solution within standard C, such as an array, a variable- >>> length array, or a pre-allocated memory block on the heap? > >> VLA elliminates need for alloca... > > C++ hasn't VLAs. No, neiter has alloca... -- press any key to continue or any other to quit... U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi bili naoruzani. -- Mladen Gogala
[toc] | [prev] | [next] | [standalone]
| From | Bonita Montero <Bonita.Montero@gmail.com> |
|---|---|
| Date | 2019-10-01 10:57 +0200 |
| Message-ID | <qmv4dd$kv6$1@news.albasani.net> |
| In reply to | #146490 |
>>> VLA elliminates need for alloca... >> C++ hasn't VLAs. > No, neiter has alloca... Doesn't matter since most compilers support alloca().
[toc] | [prev] | [next] | [standalone]
| From | Melzzzzz <Melzzzzz@zzzzz.com> |
|---|---|
| Date | 2019-10-01 18:49 +0000 |
| Message-ID | <ndNkF.453835$665.280913@fx28.am4> |
| In reply to | #146494 |
On 2019-10-01, Bonita Montero <Bonita.Montero@gmail.com> wrote: >>>> VLA elliminates need for alloca... > >>> C++ hasn't VLAs. > >> No, neiter has alloca... > > Doesn't matter since most compilers support alloca(). Which one does not supports VLA and supports alloca? > -- press any key to continue or any other to quit... U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi bili naoruzani. -- Mladen Gogala
[toc] | [prev] | [next] | [standalone]
Page 1 of 6 [1] 2 3 4 5 6 Next page →
Back to top | Article view | comp.lang.c
csiph-web