Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #96811 > unrolled thread
| Started by | "Mr. Man-wai Chang" <toylet.toylet@gmail.com> |
|---|---|
| First post | 2016-11-18 20:34 +0800 |
| Last post | 2016-11-24 18:09 +0000 |
| Articles | 20 on this page of 72 — 15 participants |
Back to article view | Back to comp.lang.c
C++ forcing unnecessary changes to C? "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-18 20:34 +0800
Re: C++ forcing unnecessary changes to C? Thiago Adams <thiago.adams@gmail.com> - 2016-11-18 05:09 -0800
Re: C++ forcing unnecessary changes to C? "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-18 21:42 +0800
Re: C++ forcing unnecessary changes to C? jameskuyper@verizon.net - 2016-11-18 11:14 -0800
Re: C++ forcing unnecessary changes to C? jameskuyper@verizon.net - 2016-11-18 11:10 -0800
Re: C++ forcing unnecessary changes to C? David Brown <david.brown@hesbynett.no> - 2016-11-19 15:26 +0100
Re: C++ forcing unnecessary changes to C? "James R. Kuyper" <jameskuyper@verizon.net> - 2016-11-19 10:09 -0500
Re: C++ forcing unnecessary changes to C? David Brown <david.brown@hesbynett.no> - 2016-11-20 13:47 +0100
Re: C++ forcing unnecessary changes to C? Thiago Adams <thiago.adams@gmail.com> - 2016-11-21 03:25 -0800
Re: C++ forcing unnecessary changes to C? David Brown <david.brown@hesbynett.no> - 2016-11-21 14:15 +0100
Re: C++ forcing unnecessary changes to C? Thiago Adams <thiago.adams@gmail.com> - 2016-11-21 05:39 -0800
Re: C++ forcing unnecessary changes to C? David Brown <david.brown@hesbynett.no> - 2016-11-18 14:26 +0100
Re: C++ forcing unnecessary changes to C? "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-18 21:41 +0800
Re: C++ forcing unnecessary changes to C? David Brown <david.brown@hesbynett.no> - 2016-11-18 15:20 +0100
Re: conduct in comp.lang.c "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-18 22:23 +0800
Re: C++ forcing unnecessary changes to C? Philipp Klaus Krause <pkk@spth.de> - 2016-11-18 15:16 +0100
Re: C++ forcing unnecessary changes to C? "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-18 22:20 +0800
Re: C++ forcing unnecessary changes to C? jameskuyper@verizon.net - 2016-11-18 11:18 -0800
Re: C++ forcing unnecessary changes to C? supercat@casperkitty.com - 2016-11-18 07:15 -0800
Re: C++ forcing unnecessary changes to C? David Brown <david.brown@hesbynett.no> - 2016-11-18 16:55 +0100
Re: C++ forcing unnecessary changes to C? supercat@casperkitty.com - 2016-11-18 08:31 -0800
Re: C++ forcing unnecessary changes to C? David Brown <david.brown@hesbynett.no> - 2016-11-18 17:38 +0100
Re: C++ forcing unnecessary changes to C? John Bode <jfbode1029@gmail.com> - 2016-11-18 07:09 -0800
Re: C++ forcing unnecessary changes to C? Thiago Adams <thiago.adams@gmail.com> - 2016-11-18 07:22 -0800
Re: C++ forcing unnecessary changes to C? Thiago Adams <thiago.adams@gmail.com> - 2016-11-18 07:31 -0800
Re: C++ forcing unnecessary changes to C? David Brown <david.brown@hesbynett.no> - 2016-11-18 17:04 +0100
Re: C++ forcing unnecessary changes to C? jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-18 16:37 +0100
Re: C++ forcing unnecessary changes to C? "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-18 23:53 +0800
Re: C++ forcing unnecessary changes to C? supercat@casperkitty.com - 2016-11-18 08:00 -0800
Re: C++ forcing unnecessary changes to C? David Brown <david.brown@hesbynett.no> - 2016-11-18 17:34 +0100
Re: C++ forcing unnecessary changes to C? Keith Thompson <kst-u@mib.org> - 2016-11-18 09:32 -0800
Re: C++ forcing unnecessary changes to C? David Brown <david.brown@hesbynett.no> - 2016-11-18 17:09 +0100
Re: C++ forcing unnecessary changes to C? jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-18 18:02 +0100
Re: C++ forcing unnecessary changes to C? Robert Wessel <robertwessel2@yahoo.com> - 2016-11-21 03:26 -0600
Re: C++ forcing unnecessary changes to C? jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-22 11:11 +0100
Re: C++ forcing unnecessary changes to C? jameskuyper@verizon.net - 2016-11-22 08:55 -0800
Re: C++ forcing unnecessary changes to C? Robert Wessel <robertwessel2@yahoo.com> - 2016-11-25 03:25 -0600
Re: C++ forcing unnecessary changes to C? supercat@casperkitty.com - 2016-11-25 10:00 -0800
Re: C++ forcing unnecessary changes to C? Keith Thompson <kst-u@mib.org> - 2016-11-25 12:30 -0800
Re: C++ forcing unnecessary changes to C? jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-26 00:38 +0100
Re: C++ forcing unnecessary changes to C? supercat@casperkitty.com - 2016-11-26 10:44 -0800
Re: C++ forcing unnecessary changes to C? jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-26 20:44 +0100
Re: C++ forcing unnecessary changes to C? supercat@casperkitty.com - 2016-11-26 12:38 -0800
Re: C++ forcing unnecessary changes to C? jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-26 21:00 +0100
Re: C++ forcing unnecessary changes to C? jameskuyper@verizon.net - 2016-11-18 11:04 -0800
Re: [OT] discipline and obedience "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-19 22:53 +0800
Re: C & C++ Committee "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-19 22:55 +0800
Re: C & C++ Committee jameskuyper@verizon.net - 2016-11-19 08:02 -0800
Re: C & C++ Committee "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-20 00:09 +0800
Re: C & C++ Committee jameskuyper@verizon.net - 2016-11-19 08:35 -0800
Re: C & C++ Committee fir <profesor.fir@gmail.com> - 2016-11-19 08:51 -0800
Re: Do you write C programs? "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-20 01:00 +0800
Re: C & C++ Committee "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-20 00:59 +0800
Re: C++ forcing unnecessary changes to C? jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-22 11:14 +0100
Re: C++ forcing unnecessary changes to C? David Brown <david.brown@hesbynett.no> - 2016-11-22 12:05 +0100
Re: C++ forcing unnecessary changes to C? jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-22 14:51 +0100
Re: C++ forcing unnecessary changes to C? David Brown <david.brown@hesbynett.no> - 2016-11-22 15:50 +0100
Re: C++ forcing unnecessary changes to C? BartC <bc@freeuk.com> - 2016-11-22 15:01 +0000
Re: C++ forcing unnecessary changes to C? Keith Thompson <kst-u@mib.org> - 2016-11-22 08:58 -0800
Re: C++ forcing unnecessary changes to C? jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-22 18:08 +0100
Re: C++ forcing unnecessary changes to C? BartC <bc@freeuk.com> - 2016-11-22 18:14 +0000
Re: C++ forcing unnecessary changes to C? Ian Collins <ian-news@hotmail.com> - 2016-11-23 08:33 +1300
Re: C++ forcing unnecessary changes to C? BartC <bc@freeuk.com> - 2016-11-22 19:42 +0000
Re: C++ forcing unnecessary changes to C? Ian Collins <ian-news@hotmail.com> - 2016-11-23 08:51 +1300
Re: C++ forcing unnecessary changes to C? Keith Thompson <kst-u@mib.org> - 2016-11-22 12:13 -0800
Re: C++ forcing unnecessary changes to C? BartC <bc@freeuk.com> - 2016-11-22 21:35 +0000
Re: C++ forcing unnecessary changes to C? David Brown <david.brown@hesbynett.no> - 2016-11-23 00:47 +0100
Re: C++ forcing unnecessary changes to C? Keith Thompson <kst-u@mib.org> - 2016-11-22 12:09 -0800
Re: C++ forcing unnecessary changes to C? David Brown <david.brown@hesbynett.no> - 2016-11-23 00:40 +0100
Re: C++ forcing unnecessary changes to C? jacobnavia <jacob@jacob.remcomp.fr> - 2016-11-26 01:27 +0100
Re: C++ forcing unnecessary changes to C? David Brown <david.brown@hesbynett.no> - 2016-11-26 01:48 +0100
Re: C++ forcing unnecessary changes to C? Nathan Wagner <nw@hydaspes.if.org> - 2016-11-24 18:09 +0000
Page 1 of 4 [1] 2 3 4 Next page →
| From | "Mr. Man-wai Chang" <toylet.toylet@gmail.com> |
|---|---|
| Date | 2016-11-18 20:34 +0800 |
| Subject | C++ forcing unnecessary changes to C? |
| Message-ID | <o0mseq$e7o$1@dont-email.me> |
IS it a stupid comment?
[toc] | [next] | [standalone]
| From | Thiago Adams <thiago.adams@gmail.com> |
|---|---|
| Date | 2016-11-18 05:09 -0800 |
| Message-ID | <139445c5-9d66-4eb0-9691-7cd3b2c05568@googlegroups.com> |
| In reply to | #96811 |
On Friday, November 18, 2016 at 10:34:12 AM UTC-2, Mr. Man-wai Chang wrote: > IS it a stupid comment? C++ is changing without care about C. Maybe the opposite is true? The languages are diverging. We cannot write C99 and compile using C++.
[toc] | [prev] | [next] | [standalone]
| From | "Mr. Man-wai Chang" <toylet.toylet@gmail.com> |
|---|---|
| Date | 2016-11-18 21:42 +0800 |
| Message-ID | <o0n0el$s26$3@dont-email.me> |
| In reply to | #96816 |
On 18/11/2016 9:09 PM, Thiago Adams wrote: > C++ is changing without care about C. Maybe the opposite is true? > The languages are diverging. > We cannot write C99 and compile using C++. Never written nor submitted a compiler before. Definitely wanna hear more of this "conspiracy". :)
[toc] | [prev] | [next] | [standalone]
| From | jameskuyper@verizon.net |
|---|---|
| Date | 2016-11-18 11:14 -0800 |
| Message-ID | <fe97dd47-a9eb-4ff8-9a29-19fd5993f6bf@googlegroups.com> |
| In reply to | #96820 |
On Friday, November 18, 2016 at 8:42:22 AM UTC-5, Mr. Man-wai Chang wrote: > On 18/11/2016 9:09 PM, Thiago Adams wrote: > > C++ is changing without care about C. Maybe the opposite is true? > > The languages are diverging. > > We cannot write C99 and compile using C++. > > Never written nor submitted a compiler before. ... Who were you thinking of submitting the compiler to? Are you under the misapprehension that there's some authority which checks to make sure that any given compiler conforms to the requirements of the C standard? > ... Definitely wanna hear more of this "conspiracy". :) He didn't say anything about any conspiracy. It would require a conspiracy to "force" C to do something unnecessary. Divergence between the two languages is, if anything, evidence of a failure to conspire.
[toc] | [prev] | [next] | [standalone]
| From | jameskuyper@verizon.net |
|---|---|
| Date | 2016-11-18 11:10 -0800 |
| Message-ID | <b45bdf9f-660d-4884-b16f-43fb202d6c2a@googlegroups.com> |
| In reply to | #96816 |
On Friday, November 18, 2016 at 8:09:41 AM UTC-5, Thiago Adams wrote: > On Friday, November 18, 2016 at 10:34:12 AM UTC-2, Mr. Man-wai Chang wrote: > > IS it a stupid comment? > > > C++ is changing without care about C. Maybe the opposite is true? Not true - in either direction. Both the C and C++ committees are committed to a policy of avoiding creating gratuitous incompatibilities between the two languages. A number of proposed changes to each of those language have either been rejected or modified to conform to that policy. > The languages are diverging. > We cannot write C99 and compile using C++. Sure you can. There's a number of significant differences between those two languages, but almost any useful C99 program can be re-written so that has the same behavior whether compiled with C99 or C++. It will, in general, need to be re-written to remove use of C99 features that aren't supported or have a different meaning in C++, but for most of those features, there is an alternative way to produce the desired behavior that works in both languages.
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2016-11-19 15:26 +0100 |
| Message-ID | <o0pnee$87q$1@dont-email.me> |
| In reply to | #96884 |
On 18/11/16 20:10, jameskuyper@verizon.net wrote: > On Friday, November 18, 2016 at 8:09:41 AM UTC-5, Thiago Adams wrote: >> On Friday, November 18, 2016 at 10:34:12 AM UTC-2, Mr. Man-wai Chang wrote: >>> IS it a stupid comment? >> >> >> C++ is changing without care about C. Maybe the opposite is true? > > Not true - in either direction. Both the C and C++ committees are committed to > a policy of avoiding creating gratuitous incompatibilities between the two > languages. A number of proposed changes to each of those language have either > been rejected or modified to conform to that policy. > >> The languages are diverging. >> We cannot write C99 and compile using C++. > > Sure you can. There's a number of significant differences between those two > languages, but almost any useful C99 program can be re-written so that has the > same behavior whether compiled with C99 or C++. It will, in general, need to be > re-written to remove use of C99 features that aren't supported or have a > different meaning in C++, but for most of those features, there is an > alternative way to produce the desired behavior that works in both languages. > Indeed, a lot of people /do/ write C but compile with C++ compilers - it is not uncommon on Windows, where the "standard" toolchain is MSVC which is (or was, until changing to clang) rather poor for C. To make your C code compatible with C++, you need to avoid VLAs, designated initializers, compound literals, identifiers that conflict with C++ keywords, and you need to cast your void* pointers. There are a few other minor points, but those are the main ones I think.
[toc] | [prev] | [next] | [standalone]
| From | "James R. Kuyper" <jameskuyper@verizon.net> |
|---|---|
| Date | 2016-11-19 10:09 -0500 |
| Message-ID | <b5adf780-63f2-18ce-285b-56dbc7e462b4@verizon.net> |
| In reply to | #96969 |
On 11/19/2016 09:26 AM, David Brown wrote: > On 18/11/16 20:10, jameskuyper@verizon.net wrote: >> On Friday, November 18, 2016 at 8:09:41 AM UTC-5, Thiago Adams wrote: ... >>> We cannot write C99 and compile using C++. >> >> Sure you can. There's a number of significant differences between those two >> languages, but almost any useful C99 program can be re-written so that has the >> same behavior whether compiled with C99 or C++. It will, in general, need to be >> re-written to remove use of C99 features that aren't supported or have a >> different meaning in C++, but for most of those features, there is an >> alternative way to produce the desired behavior that works in both languages. >> > > Indeed, a lot of people /do/ write C but compile with C++ compilers - it > is not uncommon on Windows, where the "standard" toolchain is MSVC which > is (or was, until changing to clang) rather poor for C. > > To make your C code compatible with C++, you need to avoid VLAs, > designated initializers, compound literals, identifiers that conflict > with C++ keywords, and you need to cast your void* pointers. There are > a few other minor points, but those are the main ones I think. If you have a good reason for doing this, pay close attention to Annex C of the C++ standard, which provides a fairly comprehensive list of the differences. It's 8 pages long, so familiarizing yourself with those differences isn't horribly difficult, but neither is it trivial.
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2016-11-20 13:47 +0100 |
| Message-ID | <o0s5va$hmb$1@dont-email.me> |
| In reply to | #96980 |
On 19/11/16 16:09, James R. Kuyper wrote: > On 11/19/2016 09:26 AM, David Brown wrote: >> On 18/11/16 20:10, jameskuyper@verizon.net wrote: >>> On Friday, November 18, 2016 at 8:09:41 AM UTC-5, Thiago Adams wrote: > ... >>>> We cannot write C99 and compile using C++. >>> >>> Sure you can. There's a number of significant differences between >>> those two >>> languages, but almost any useful C99 program can be re-written so >>> that has the >>> same behavior whether compiled with C99 or C++. It will, in general, >>> need to be >>> re-written to remove use of C99 features that aren't supported or have a >>> different meaning in C++, but for most of those features, there is an >>> alternative way to produce the desired behavior that works in both >>> languages. >>> >> >> Indeed, a lot of people /do/ write C but compile with C++ compilers - it >> is not uncommon on Windows, where the "standard" toolchain is MSVC which >> is (or was, until changing to clang) rather poor for C. >> >> To make your C code compatible with C++, you need to avoid VLAs, >> designated initializers, compound literals, identifiers that conflict >> with C++ keywords, and you need to cast your void* pointers. There are >> a few other minor points, but those are the main ones I think. > > If you have a good reason for doing this, pay close attention to Annex C > of the C++ standard, which provides a fairly comprehensive list of the > differences. It's 8 pages long, so familiarizing yourself with those > differences isn't horribly difficult, but neither is it trivial. Yes, I know about that Annex. I don't think there are any major points (i.e., ones that are common, hard to work around, or may silently have different effects in the code) that I missed. But I agree that it is a useful reference.
[toc] | [prev] | [next] | [standalone]
| From | Thiago Adams <thiago.adams@gmail.com> |
|---|---|
| Date | 2016-11-21 03:25 -0800 |
| Message-ID | <9f66f928-dfb0-450d-ab24-bacd71377b26@googlegroups.com> |
| In reply to | #96884 |
On Friday, November 18, 2016 at 5:10:56 PM UTC-2, james...@verizon.net wrote: > On Friday, November 18, 2016 at 8:09:41 AM UTC-5, Thiago Adams wrote: > > On Friday, November 18, 2016 at 10:34:12 AM UTC-2, Mr. Man-wai Chang wrote: > > > IS it a stupid comment? > > > > > > C++ is changing without care about C. Maybe the opposite is true? > > Not true - in either direction. Both the C and C++ committees are committed to > a policy of avoiding creating gratuitous incompatibilities between the two > languages. A number of proposed changes to each of those language have either > been rejected or modified to conform to that policy. > > > The languages are diverging. > > We cannot write C99 and compile using C++. > > Sure you can. There's a number of significant differences between those two > languages, but almost any useful C99 program can be re-written so that has the > same behavior whether compiled with C99 or C++. It will, in general, need to be > re-written to remove use of C99 features that aren't supported or have a > different meaning in C++, but for most of those features, there is an > alternative way to produce the desired behavior that works in both languages. I will give one more case where the intersection C11/C++17 is becoming difficult. I you are working with multiprocessor environment then you probability want some thread facilities. C11 threads in others words. But if you use C 11 threads , C++ will not include this header and then you have to find/create a library by yourself. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0063r2.html
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2016-11-21 14:15 +0100 |
| Message-ID | <o0us13$uap$1@dont-email.me> |
| In reply to | #97184 |
On 21/11/16 12:25, Thiago Adams wrote: > On Friday, November 18, 2016 at 5:10:56 PM UTC-2, james...@verizon.net wrote: >> On Friday, November 18, 2016 at 8:09:41 AM UTC-5, Thiago Adams wrote: >>> On Friday, November 18, 2016 at 10:34:12 AM UTC-2, Mr. Man-wai Chang wrote: >>>> IS it a stupid comment? >>> >>> >>> C++ is changing without care about C. Maybe the opposite is true? >> >> Not true - in either direction. Both the C and C++ committees are committed to >> a policy of avoiding creating gratuitous incompatibilities between the two >> languages. A number of proposed changes to each of those language have either >> been rejected or modified to conform to that policy. >> >>> The languages are diverging. >>> We cannot write C99 and compile using C++. >> >> Sure you can. There's a number of significant differences between those two >> languages, but almost any useful C99 program can be re-written so that has the >> same behavior whether compiled with C99 or C++. It will, in general, need to be >> re-written to remove use of C99 features that aren't supported or have a >> different meaning in C++, but for most of those features, there is an >> alternative way to produce the desired behavior that works in both languages. > > > I will give one more case where the intersection C11/C++17 is becoming difficult. > > I you are working with multiprocessor environment then you > probability want some thread facilities. C11 threads in others words. But if you use > C 11 threads , C++ will not include this header and then you have to > find/create a library by yourself. > > http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0063r2.html > I am not sure which part of this you are referring to, but I think that C11 and C++11 (and later) threads and atomics should be compatible. (And signal handlers are always awkward.) I also wonder how popular C11 and C++11 threading actually is. They don't seem particularly useful for embedded systems, since they don't have features such as priority control or stack sizes. And on big systems you typically already have either pthreads or Windows threads, or a cross-platform library such as QT or WX that handles these details.
[toc] | [prev] | [next] | [standalone]
| From | Thiago Adams <thiago.adams@gmail.com> |
|---|---|
| Date | 2016-11-21 05:39 -0800 |
| Message-ID | <fddee800-a78b-4d80-8b67-9ecd8ec33621@googlegroups.com> |
| In reply to | #97195 |
On Monday, November 21, 2016 at 11:15:59 AM UTC-2, David Brown wrote: > On 21/11/16 12:25, Thiago Adams wrote: > > On Friday, November 18, 2016 at 5:10:56 PM UTC-2, james...@verizon.net wrote: > >> On Friday, November 18, 2016 at 8:09:41 AM UTC-5, Thiago Adams wrote: > >>> On Friday, November 18, 2016 at 10:34:12 AM UTC-2, Mr. Man-wai Chang wrote: > >>>> IS it a stupid comment? > >>> > >>> > >>> C++ is changing without care about C. Maybe the opposite is true? > >> > >> Not true - in either direction. Both the C and C++ committees are committed to > >> a policy of avoiding creating gratuitous incompatibilities between the two > >> languages. A number of proposed changes to each of those language have either > >> been rejected or modified to conform to that policy. > >> > >>> The languages are diverging. > >>> We cannot write C99 and compile using C++. > >> > >> Sure you can. There's a number of significant differences between those two > >> languages, but almost any useful C99 program can be re-written so that has the > >> same behavior whether compiled with C99 or C++. It will, in general, need to be > >> re-written to remove use of C99 features that aren't supported or have a > >> different meaning in C++, but for most of those features, there is an > >> alternative way to produce the desired behavior that works in both languages. > > > > > > I will give one more case where the intersection C11/C++17 is becoming difficult. > > > > I you are working with multiprocessor environment then you > > probability want some thread facilities. C11 threads in others words. But if you use > > C 11 threads , C++ will not include this header and then you have to > > find/create a library by yourself. > > > > http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0063r2.html > > > > I am not sure which part of this you are referring to, but I think that > C11 and C++11 (and later) threads and atomics should be compatible. > (And signal handlers are always awkward.) Atomics are compatible only using macros. C header file <thread.h> will not be added to C++. So, you have to choose if you want to use C or C++ or find/create your own <thread.h>. > I also wonder how popular C11 and C++11 threading actually is. They > don't seem particularly useful for embedded systems, since they don't > have features such as priority control or stack sizes. And on big > systems you typically already have either pthreads or Windows threads, > or a cross-platform library such as QT or WX that handles these details. I think thread.h is not popular, but it should be because it's something very basic to be implemented differently . C++ gives the native handle for threads to do any extra customization. I didn't find it in C.
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2016-11-18 14:26 +0100 |
| Message-ID | <o0mvgs$pl9$1@dont-email.me> |
| In reply to | #96811 |
On 18/11/16 13:34, Mr. Man-wai Chang wrote: > > IS it a stupid comment? Yes. It is a stupid post, because you still don't understand Usenet, how to post, what is relevant to comp.lang.c, how to address people, or even how to express yourself properly. Let me give you a number of guidelines. Read them, understand them, and apply them - and people will pay attention to you. At the moment, I suspect a good many of the regulars here mostly ignore your posts without bothering to read them. 1. Think about what you want to ask or say before you write. Is it really something worth saying? Is it of interest to the group, or is it a question that the group can help answer? 2. The subject line provides a summary of the thread subject - it is /not/ part of the post or question. The post should be complete on its own, and it is rare that a single line or two is sufficient to express your point of view. 3. If you get involved in threads that are completely off-topic (religion, politics, anything posted by Fir's cat, etc.), then you will annoy some of the regulars. If you don't start such threads and only reply within them once they are already clearly off-topic, then you will annoy some of the key C experts in this group. If you start such threads or sub-threads, or make many such posts, then you will annoy a great deal more people. 4. If you write in a childish manner, people will treat you as a child. No one wants to be called "master" or see pointless smilies. 5. Read through your posts before hitting "send". Does the post make sense? Does it sound patronising or silly? Does it contribute something useful or informative? Is it a post suitable for comp.lang.c, fitting the style of the group, or is it just time-wasting and random thoughts?
[toc] | [prev] | [next] | [standalone]
| From | "Mr. Man-wai Chang" <toylet.toylet@gmail.com> |
|---|---|
| Date | 2016-11-18 21:41 +0800 |
| Message-ID | <o0n0d1$s26$2@dont-email.me> |
| In reply to | #96817 |
On 18/11/2016 9:26 PM, David Brown wrote: > Yes. > > It is a stupid post, because you still don't understand Usenet, how to > post, what is relevant to comp.lang.c, how to address people, or even > how to express yourself properly. Not everyone has you Masters' brains, and experiences. This newsgroup should not use conduct guidelines to stop kids from posting here. They may ask simple sometimes naive questions, but it's still a good lesson for teachers and masters to review something basic.
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2016-11-18 15:20 +0100 |
| Message-ID | <o0n2lu$5k5$1@dont-email.me> |
| In reply to | #96819 |
On 18/11/16 14:41, Mr. Man-wai Chang wrote: > On 18/11/2016 9:26 PM, David Brown wrote: >> Yes. >> >> It is a stupid post, because you still don't understand Usenet, how to >> post, what is relevant to comp.lang.c, how to address people, or even >> how to express yourself properly. > > Not everyone has you Masters' brains, and experiences. This newsgroup > should not use conduct guidelines to stop kids from posting here. They > may ask simple sometimes naive questions, but it's still a good lesson > for teachers and masters to review something basic. > Are you a child? If you are, then say so - and people will take that into account. And if you are here to learn, then demonstrate it. You don't have much experience with Usenet, so I have given you some help. Learn from it, and make an effort to improve on how you write in c.l.c. I don't mean you should not ask naïve questions - or any other sort of C-related questions. You are welcome to ask about the influence C++ has on C. But please express your questions in an appropriate way - then you can get more useful answers and a more useful discussion. You wrote this post: > IS it a stupid comment? The answer is clearly "yes". Instead, you could have written: > How much influence does C++ have on modern C? Is C changing to > become more like C++? Is this a good thing? > > For example, "const" and "inline" were copied from C++ to C. Did > they spoil the simplicity of C? > > I think generic macros in C11 are a sort of fake function overload > and a bad idea in C. > That would have shown that you have actually thought about the question you are asking, and introduced some points to discuss. (My personal answer would be that C++ is not forcing anything upon C. The C standards committee have taken a few useful ideas from C++, and they make some effort not to be gratuitously incompatible, but that is not C++ "forcing" changes on C.)
[toc] | [prev] | [next] | [standalone]
| From | "Mr. Man-wai Chang" <toylet.toylet@gmail.com> |
|---|---|
| Date | 2016-11-18 22:23 +0800 |
| Subject | Re: conduct in comp.lang.c |
| Message-ID | <o0n2r9$54m$4@dont-email.me> |
| In reply to | #96825 |
Thank you, Master! On 18/11/2016 10:20 PM, David Brown wrote: > Are you a child? > > If you are, then say so - and people will take that into account. > > And if you are here to learn, then demonstrate it. You don't have much > experience with Usenet, so I have given you some help. Learn from it, > and make an effort to improve on how you write in c.l.c. > > I don't mean you should not ask naïve questions - or any other sort of > C-related questions. You are welcome to ask about the influence C++ has > on C. But please express your questions in an appropriate way - then > you can get more useful answers and a more useful discussion. > > You wrote this post: > >> IS it a stupid comment? > > The answer is clearly "yes". > > Instead, you could have written:
[toc] | [prev] | [next] | [standalone]
| From | Philipp Klaus Krause <pkk@spth.de> |
|---|---|
| Date | 2016-11-18 15:16 +0100 |
| Message-ID | <o0n2fs$reu$1@solani.org> |
| In reply to | #96811 |
On 18.11.2016 13:34, Mr. Man-wai Chang wrote: > > IS it a stupid comment? It looks like a legitimate question to me. From my experience, C++ does not force any changes on C, unnecessary or otherwise. However, when a certain feature gets added to C, C tends to follow the C++ syntax if the feature already exists in C++. Even if a different syntax would have been chosen otherwise. For a current example see attributes (e.g. N 2049). Also from the C2x charter (N 2021): "Areas to which the committee shall look when revising C include: […] * The evolution of C++ and other C based programming languages. […]" Philipp
[toc] | [prev] | [next] | [standalone]
| From | "Mr. Man-wai Chang" <toylet.toylet@gmail.com> |
|---|---|
| Date | 2016-11-18 22:20 +0800 |
| Message-ID | <o0n2ll$54m$1@dont-email.me> |
| In reply to | #96823 |
On 18/11/2016 10:16 PM, Philipp Klaus Krause wrote: > From my experience, C++ does not force any changes on C, unnecessary or > otherwise. > > However, when a certain feature gets added to C, C tends to follow the > C++ syntax if the feature already exists in C++. Even if a > different syntax would have been chosen otherwise. For a current example > see attributes (e.g. N 2049). I was thinking about security and malware kinds of stuff... Imagine what happen when you weaken and attack the C pillar of a building by stacking C++ stuff on it? :)
[toc] | [prev] | [next] | [standalone]
| From | jameskuyper@verizon.net |
|---|---|
| Date | 2016-11-18 11:18 -0800 |
| Message-ID | <c1f8f0bc-4bdb-4df2-a9f3-43a267778c9a@googlegroups.com> |
| In reply to | #96824 |
On Friday, November 18, 2016 at 9:20:14 AM UTC-5, Mr. Man-wai Chang wrote: ... > I was thinking about security and malware kinds of stuff... To make a meaningful conversation, you'll need to be far more specific than that. > Imagine what happen when you weaken and attack the C pillar of a > building by stacking C++ stuff on it? :) Do you have any reason to think such stacking is occurring? If you did, presenting that reason would be the first thing you should do before making any attempt to further this discussion.
[toc] | [prev] | [next] | [standalone]
| From | supercat@casperkitty.com |
|---|---|
| Date | 2016-11-18 07:15 -0800 |
| Message-ID | <22e1d500-d9ec-489b-aa34-604e0923020e@googlegroups.com> |
| In reply to | #96823 |
On Friday, November 18, 2016 at 8:16:36 AM UTC-6, Philipp Klaus Krause wrote: > From my experience, C++ does not force any changes on C, unnecessary or > otherwise. From what I can tell, essentially all compilers for commonplace platforms used to regard x<<y as yielding an Unspecified choice between x<<(y % wordsize) and (x<<(y-1))<<1, and likewise for right-shifts. The idiomatic way to write a rotate left was (x<<y)|(x>>(wordsize-y)); because that was the most natural way to write that pattern, compilers could easily look for that exact pattern and substitute a rotate-left instruction. C++ *requires* that an exact shift by the word size be recognized as "UB" [contrary to the definition of UB, incidentally], which means that what used to be the idiomatic way of doing a rotate left is explicitly invalid. C compilers have since followed suit. I don't know if C compilers would have started requiring that programmers replace the nice clean idiomatic ways of doing bit-rotate operations with slower ways that many compilers won't optimize, had it not been for the C++ requirements.
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2016-11-18 16:55 +0100 |
| Message-ID | <o0n889$psm$1@dont-email.me> |
| In reply to | #96841 |
On 18/11/16 16:15, supercat@casperkitty.com wrote: > On Friday, November 18, 2016 at 8:16:36 AM UTC-6, Philipp Klaus Krause wrote: >> From my experience, C++ does not force any changes on C, unnecessary or >> otherwise. > > From what I can tell, essentially all compilers for commonplace platforms > used to regard x<<y as yielding an Unspecified choice between x<<(y % wordsize) > and (x<<(y-1))<<1, and likewise for right-shifts. The idiomatic way to write > a rotate left was (x<<y)|(x>>(wordsize-y)); because that was the most natural > way to write that pattern, compilers could easily look for that exact pattern > and substitute a rotate-left instruction. There was no "idiomatic way" to write rotate operations, because rotate operations are not common enough to warrant idioms. A compiler may or may not defined the behaviour of shifts outside the ranges given in the standard. Someone needing a shift in their code may write correct portable code, or correct implementation-dependent code, or code that just happens to work without any guarantees. I think it is this later choice that you think of as "idiomatic", and believe that because someone might have written this, compilers should be obliged to implement it. > > C++ *requires* that an exact shift by the word size be recognized as "UB" > [contrary to the definition of UB, incidentally], which means that what > used to be the idiomatic way of doing a rotate left is explicitly invalid. > C compilers have since followed suit. I don't know if C compilers would > have started requiring that programmers replace the nice clean idiomatic > ways of doing bit-rotate operations with slower ways that many compilers > won't optimize, had it not been for the C++ requirements. > From §6.5.7 in C11 (N1570): If the value of the right operand is negative or is greater than or equal to the width of the promoted left operand, the behavior is undefined. From §5.8 in C++14 (N3797): The behavior is undefined if the right operand is negative, or greater than or equal to the length in bits of the promoted left operand It seems to me that C and C++ follow /exactly/ the same rules here. I haven't bothered checking other versions of the standards, so it is conceivable that the details have changed - I leave it to you to dig out chapter and verse if you still think there is any substance to your claims here.
[toc] | [prev] | [next] | [standalone]
Page 1 of 4 [1] 2 3 4 Next page →
Back to top | Article view | comp.lang.c
csiph-web