Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #111355 > unrolled thread

High quality resources for learning modern C?

Started byLeon Taylor <leontaylor476@gmail.com>
First post2017-06-03 04:44 -0700
Last post2017-06-11 15:54 -0700
Articles 20 on this page of 93 — 23 participants

Back to article view | Back to comp.lang.c


Contents

  High quality resources for learning modern C? Leon Taylor <leontaylor476@gmail.com> - 2017-06-03 04:44 -0700
    Re: High quality resources for learning modern C? gazelle@shell.xmission.com (Kenny McCormack) - 2017-06-03 11:49 +0000
      Re: High quality resources for learning modern C? Leon Taylor <leontaylor476@gmail.com> - 2017-06-03 05:17 -0700
      Re: High quality resources for learning modern C? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2017-06-03 05:45 -0700
    Re: High quality resources for learning modern C? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-06-03 14:43 +0200
      Re: High quality resources for learning modern C? Noob <root@127.0.0.1> - 2017-06-03 17:21 +0200
        Re: High quality resources for learning modern C? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-06-03 18:15 +0200
          Re: High quality resources for learning modern C? jacobnavia <jacob@jacob.remcomp.fr> - 2017-06-03 21:16 +0200
            Re: High quality resources for learning modern C? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-06-03 22:56 +0200
            Re: High quality resources for learning modern C? Philipp Klaus Krause <pkk@spth.de> - 2017-06-03 23:32 +0200
          Re: High quality resources for learning modern C? Noob <root@127.0.0.1> - 2017-06-03 22:20 +0200
            Re: High quality resources for learning modern C? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-06-03 23:00 +0200
              Re: High quality resources for learning modern C? Noob <root@127.0.0.1> - 2017-06-04 00:03 +0200
                Re: High quality resources for learning modern C? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-06-04 00:08 +0200
    Re: High quality resources for learning modern C? Philipp Klaus Krause <pkk@spth.de> - 2017-06-03 18:32 +0200
      Re: High quality resources for learning modern C? Leon Taylor <leontaylor476@gmail.com> - 2017-06-03 17:05 -0700
    Re: High quality resources for learning modern C? Real Troll <real.troll@trolls.com> - 2017-06-03 13:30 -0400
      Re: High quality resources for learning modern C? bartc <bc@freeuk.com> - 2017-06-03 18:59 +0100
        Re: High quality resources for learning modern C? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-06-03 20:49 +0200
          Re: High quality resources for learning modern C? jacobnavia <jacob@jacob.remcomp.fr> - 2017-06-03 21:12 +0200
            Re: High quality resources for learning modern C? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-06-03 23:13 +0200
              Re: High quality resources for learning modern C? jacobnavia <jacob@jacob.remcomp.fr> - 2017-06-03 23:37 +0200
            Re: High quality resources for learning modern C? Thiago Adams <thiago.adams@gmail.com> - 2017-06-03 15:12 -0700
              Re: High quality resources for learning modern C? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-06-04 00:16 +0200
        Re: High quality resources for learning modern C? jacobnavia <jacob@jacob.remcomp.fr> - 2017-06-03 21:08 +0200
          Re: High quality resources for learning modern C? bartc <bc@freeuk.com> - 2017-06-03 21:08 +0100
          Re: High quality resources for learning modern C? bartc <bc@freeuk.com> - 2017-06-06 19:29 +0100
        Re: High quality resources for learning modern C? Real Troll <Real.Troll@Trolls.com> - 2017-06-03 17:15 -0400
          Re: High quality resources for learning modern C? bartc <bc@freeuk.com> - 2017-06-05 22:58 +0100
            Re: High quality resources for learning modern C? Keith Thompson <kst-u@mib.org> - 2017-06-05 15:51 -0700
              Re: High quality resources for learning modern C? bartc <bc@freeuk.com> - 2017-06-06 00:22 +0100
              Re: High quality resources for learning modern C? supercat@casperkitty.com - 2017-06-05 17:05 -0700
                Re: High quality resources for learning modern C? Keith Thompson <kst-u@mib.org> - 2017-06-05 17:57 -0700
      Re: High quality resources for learning modern C? raltbos@xs4all.nl (Richard Bos) - 2017-06-03 18:13 +0000
        Re: High quality resources for learning modern C? Leon Taylor <leontaylor476@gmail.com> - 2017-06-03 17:07 -0700
        Re: High quality resources for learning modern C? Keith Thompson <kst-u@mib.org> - 2017-06-03 18:20 -0700
          Re: High quality resources for learning modern C? Leon Taylor <leontaylor476@gmail.com> - 2017-06-03 19:59 -0700
      Re: High quality resources for learning modern C? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-06-03 20:39 +0200
      Re: High quality resources for learning modern C? Barry Schwarz <schwarzb@dqel.com> - 2017-06-03 14:01 -0700
      Re: High quality resources for learning modern C? Leon Taylor <leontaylor476@gmail.com> - 2017-06-03 17:08 -0700
    Re: High quality resources for learning modern C? David Brown <david.brown@hesbynett.no> - 2017-06-04 16:53 +0200
      Re: High quality resources for learning modern C? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-06-04 17:04 +0200
        Re: High quality resources for learning modern C? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-04 22:03 +0100
          Re: High quality resources for learning modern C? Leon Taylor <leontaylor476@gmail.com> - 2017-06-04 16:11 -0700
            Re: High quality resources for learning modern C? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-05 00:43 +0100
              Re: High quality resources for learning modern C? David Brown <david.brown@hesbynett.no> - 2017-06-05 11:56 +0200
                Re: High quality resources for learning modern C? Leon Taylor <leontaylor476@gmail.com> - 2017-06-05 03:28 -0700
                  Re: High quality resources for learning modern C? David Brown <david.brown@hesbynett.no> - 2017-06-05 12:39 +0200
      Re: High quality resources for learning modern C? Leon Taylor <leontaylor476@gmail.com> - 2017-06-04 16:06 -0700
        Re: High quality resources for learning modern C? Ian Collins <ian-news@hotmail.com> - 2017-06-05 14:09 +1200
      Re: High quality resources for learning modern C? raltbos@xs4all.nl (Richard Bos) - 2017-06-05 08:43 +0000
        Re: High quality resources for learning modern C? David Brown <david.brown@hesbynett.no> - 2017-06-05 12:08 +0200
          Re: High quality resources for learning modern C? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2017-06-05 03:49 -0700
          Re: High quality resources for learning modern C? GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-06-05 14:53 +0200
        Re: High quality resources for learning modern C? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-05 11:48 +0100
        Re: High quality resources for learning modern C? supercat@casperkitty.com - 2017-06-05 07:28 -0700
          Re: High quality resources for learning modern C? David Kleinecke <dkleinecke@gmail.com> - 2017-06-05 11:52 -0700
            Re: High quality resources for learning modern C? Keith Thompson <kst-u@mib.org> - 2017-06-05 12:23 -0700
            Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-05 12:46 -0700
              Re: High quality resources for learning modern C? David Kleinecke <dkleinecke@gmail.com> - 2017-06-05 17:46 -0700
                Re: High quality resources for learning modern C? bartc <bc@freeuk.com> - 2017-06-06 01:58 +0100
                Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-05 20:09 -0700
                Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-05 20:16 -0700
                  Re: High quality resources for learning modern C? David Kleinecke <dkleinecke@gmail.com> - 2017-06-05 21:57 -0700
                    Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-06 07:36 -0700
                      Re: High quality resources for learning modern C? supercat@casperkitty.com - 2017-06-06 09:29 -0700
                        Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-06 10:13 -0700
                          Re: High quality resources for learning modern C? supercat@casperkitty.com - 2017-06-06 13:37 -0700
                            Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-06 15:23 -0700
                              Re: High quality resources for learning modern C? supercat@casperkitty.com - 2017-06-06 16:32 -0700
                                Re: High quality resources for learning modern C? David Kleinecke <dkleinecke@gmail.com> - 2017-06-06 19:02 -0700
                                  Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-06 20:20 -0700
                                    Re: High quality resources for learning modern C? David Kleinecke <dkleinecke@gmail.com> - 2017-06-07 18:36 -0700
                                      Re: High quality resources for learning modern C? Keith Thompson <kst-u@mib.org> - 2017-06-07 19:25 -0700
                                        Re: High quality resources for learning modern C? David Kleinecke <dkleinecke@gmail.com> - 2017-06-07 20:09 -0700
                                          Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-07 20:56 -0700
                                          Re: High quality resources for learning modern C? Keith Thompson <kst-u@mib.org> - 2017-06-08 09:03 -0700
                                        Re: High quality resources for learning modern C? James Kuyper <jameskuyper@verizon.net> - 2017-06-07 23:14 -0400
                                      Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-07 20:42 -0700
                                Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-06 20:08 -0700
                                  Re: High quality resources for learning modern C? supercat@casperkitty.com - 2017-06-07 07:46 -0700
                                    Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-07 09:02 -0700
                                      Re: High quality resources for learning modern C? supercat@casperkitty.com - 2017-06-07 15:14 -0700
                                        Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-07 16:36 -0700
                                          Re: High quality resources for learning modern C? supercat@casperkitty.com - 2017-06-08 08:10 -0700
                                            Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-08 10:43 -0700
                                          Re: High quality resources for learning modern C? "James R. Kuyper" <jameskuyper@verizon.net> - 2017-06-08 12:37 -0400
                                            Re: High quality resources for learning modern C? Tim Rentsch <txr@alumni.caltech.edu> - 2017-06-09 10:36 -0700
                                              Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-09 11:09 -0700
                                                Re: High quality resources for learning modern C? supercat@casperkitty.com - 2017-06-09 12:00 -0700
                                                  Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-09 12:45 -0700
                                                    Re: High quality resources for learning modern C? jameskuyper@verizon.net - 2017-06-09 14:11 -0700
                                                Re: High quality resources for learning modern C? Tim Rentsch <txr@alumni.caltech.edu> - 2017-06-11 15:54 -0700

Page 2 of 5 — ← Prev page 1 [2] 3 4 5  Next page →


#111422

FromGOTHIER Nathan <nathan.gothier@gmail.com>
Date2017-06-03 23:13 +0200
Message-ID<20170603231339.a3eef1a94e3fe21f20f02617@gmail.com>
In reply to#111399
On Sat, 3 Jun 2017 21:12:12 +0200
jacobnavia <jacob@jacob.remcomp.fr> wrote:

> Microsoft visual studio compiles any C program that conforms to the 
> common C++/C subset.

How many time should that be said? There's no subset of C or C++ in common
since there are two different standards with different behaviors (e.g. NULL).
If the imaginary subset was a reality nobody would have to put rotten macros on
any C header to mix C libraries with C++ code.

[toc] | [prev] | [next] | [standalone]


#111427

Fromjacobnavia <jacob@jacob.remcomp.fr>
Date2017-06-03 23:37 +0200
Message-ID<ogva0e$q3f$1@dont-email.me>
In reply to#111422
Le 03/06/2017 à 23:13, GOTHIER Nathan a écrit :
> There's no subset of C or C++ in common

OK, just go on.

I am done here

[toc] | [prev] | [next] | [standalone]


#111432

FromThiago Adams <thiago.adams@gmail.com>
Date2017-06-03 15:12 -0700
Message-ID<166ea7d9-cf0e-4110-8d2e-447293ffe5c7@googlegroups.com>
In reply to#111399
You can compile C programs in visual studio.
Some updates have been made. 
C99 initializers, for instance, works. 

You can also use clang front end inside vs.

You can force c or c++ compiler independent   of file extension and try the same source in different compilers. 

(I use visual studio if someone needs more details)

[toc] | [prev] | [next] | [standalone]


#111434

FromGOTHIER Nathan <nathan.gothier@gmail.com>
Date2017-06-04 00:16 +0200
Message-ID<20170604001630.fbd59a6cbd3285392c726e23@gmail.com>
In reply to#111432
On Sat, 3 Jun 2017 15:12:50 -0700 (PDT)
Thiago Adams <thiago.adams@gmail.com> wrote:

> You can compile C programs in visual studio.
> Some updates have been made. 
> C99 initializers, for instance, works. 
> 
> You can also use clang front end inside vs.
> 
> You can force c or c++ compiler independent   of file extension and try the
> same source in different compilers. 
> 
> (I use visual studio if someone needs more details)

So you have to create a C++ project to trick Visual Studio with your C source.
How can you trick MSVS to force C90 compliance? :-)

[toc] | [prev] | [next] | [standalone]


#111398

Fromjacobnavia <jacob@jacob.remcomp.fr>
Date2017-06-03 21:08 +0200
Message-ID<ogv18g$si3$1@dont-email.me>
In reply to#111387
Le 03/06/2017 à 19:59, bartc a écrit :
> Visual Studio talks a lot about C++, and very little about C, to the 
> extent that it's hard to be sure it supports the latter at all.
> 
> I downloaded it a few weeks ago (as it was stipulated for building a 
> particular app, which it failed to do as there were other dependencies 
> that didn't work.).
> 
> While I had it, I tried to get it to compile and run Hello World. Which 
> I failed to do as well (within ten minutes messing about with it anyway).

If I do

cl hello.c

it will compile to hello.exe

Visual studio supports C, at least the C++ common subset, and some C99 
features.

It needs to be run after starting the different .bat that setup the 
environment variables. This is the standard procedure since so many 
years that I am amazed that you do not remember it.

You can start it from the IDE in the Tools sections, that with a few 
clicks puts you in a command line window where the path and other 
variables are already set up.

Starting the IDE (1 click), going into the Tools menu bar (another 
click) then the Visual studio command prompt (yet another click) and 
there you are, in a nice command line window with black background and 
white letters.

Are 3 clicks too much?

Apparently for you, yes.

OK, ranting around is your favorite hobby but...

[toc] | [prev] | [next] | [standalone]


#111406

Frombartc <bc@freeuk.com>
Date2017-06-03 21:08 +0100
Message-ID<cHEYA.233627$MA.87193@fx05.am4>
In reply to#111398
On 03/06/2017 20:08, jacobnavia wrote:
> Le 03/06/2017 à 19:59, bartc a écrit :
>> Visual Studio talks a lot about C++, and very little about C, to the 
>> extent that it's hard to be sure it supports the latter at all.
>>
>> I downloaded it a few weeks ago (as it was stipulated for building a 
>> particular app, which it failed to do as there were other dependencies 
>> that didn't work.).
>>
>> While I had it, I tried to get it to compile and run Hello World. 
>> Which I failed to do as well (within ten minutes messing about with it 
>> anyway).
> 
> If I do
> 
> cl hello.c
> 
> it will compile to hello.exe
> 
> Visual studio supports C, at least the C++ common subset, and some C99 
> features.
> 
> It needs to be run after starting the different .bat that setup the 
> environment variables.

Yes, the only version of MSVC I have (-2008 now on another machine) can 
only be run as CL via its special command window which sets up 
everything that is needed to be set up. The compiler is located 9 or 11 
levels deep in some directory structure so would be very awkward to find 
your way around (since at the level, you are typing at the right edge of 
the window).

But Visual Studio was mentioned. Otherwise I would have said the easiest 
access to a C compiler is from a terminal window on a Linux system where 
typing 'gcc hello.c' will usually work without any setup.

(These days there also online compilers, eg:

   http://rextester.com/l/c_online_compiler_gcc

which will compile and run whatever you type in. OK for very small 
programs.)


> This is the standard procedure since so many 
> years that I am amazed that you do not remember it.

I've used CL in the distance past (I may have actually paid for VC at 
some time) but don't remember any special setup.

> You can start it from the IDE in the Tools sections, that with a few 
> clicks puts you in a command line window where the path and other 
> variables are already set up.
> 
> Starting the IDE (1 click), going into the Tools menu bar (another 
> click) then the Visual studio command prompt (yet another click) and 
> there you are, in a nice command line window with black background and 
> white letters.
> 
> Are 3 clicks too much?
> 
> Apparently for you, yes.

> OK, ranting around is your favorite hobby but...

It's not ranting. It's pointing out things that a newcomer can also have 
trouble with. It you start a new source file, and type the hello, world 
code into it, then you find there is no button to compile it, and the 
run or build option on the pulldown menu is greyed out. (I don't have VS 
any more so can't remember the exact problems.)

This is why being able to build and run a Hello, World program first is 
important.

-- 
bart

[toc] | [prev] | [next] | [standalone]


#111654

Frombartc <bc@freeuk.com>
Date2017-06-06 19:29 +0100
Message-ID<qwCZA.259$UK2.111@fx01.am4>
In reply to#111398
On 03/06/2017 20:08, jacobnavia wrote:
> Le 03/06/2017 à 19:59, bartc a écrit :

>> While I had it, I tried to get it to compile and run Hello World. 
>> Which I failed to do as well (within ten minutes messing about with it 
>> anyway).
> 
> If I do
> 
> cl hello.c
> 
> it will compile to hello.exe
> 
> Visual studio supports C, at least the C++ common subset, and some C99 
> features.
> 
> It needs to be run after starting the different .bat that setup the 
> environment variables. This is the standard procedure since so many 
> years that I am amazed that you do not remember it.
> 
> You can start it from the IDE in the Tools sections, that with a few 
> clicks puts you in a command line window where the path and other 
> variables are already set up.

I couldn't see anything like that. Do you mean, Tools -> External Tools 
-> Add, then you have to /tell/ it the execution path and command 
options to use?

If I knew those, I wouldn't need VS to tell me! I can set it up myself. 
I would expect VS to /know/ exactly how to bring up a command prompt 
with the right environmental variables set up so that CL can be used 
from anywhere.

> Starting the IDE (1 click), going into the Tools menu bar (another 
> click) then the Visual studio command prompt (yet another click) and 
> there you are, in a nice command line window with black background and 
> white letters.
> 
> Are 3 clicks too much?

If I know where to click, and they do job, then no.

-- 
bartc

[toc] | [prev] | [next] | [standalone]


#111421

FromReal Troll <Real.Troll@Trolls.com>
Date2017-06-03 17:15 -0400
Message-ID<ogv8ja$1hug$1@gioia.aioe.org>
In reply to#111387
On 03/06/2017 18:59, bartc wrote:
>
> Visual Studio talks a lot about C++, and very little about C, to the 
> extent that it's hard to be sure it supports the latter at all.
>
> I downloaded it a few weeks ago (as it was stipulated for building a 
> particular app, which it failed to do as there were other dependencies 
> that didn't work.).
>
> While I had it, I tried to get it to compile and run Hello World. 
> Which I failed to do as well (within ten minutes messing about with it 
> anyway).
>



To edit/create a C program try something like this:

1> From the main menu select File -> New -> Project
2> In the New Project window select Win32 - Win32 Console Application
3> Name your project, and specify a location for your project directory
4> Click 'OK', then 'next'
5> Select Console application
6> Select Empty project
7> Deselect Precompiled header - You don't want this for your hello world!
8> On the Right hand side you should see three folders:
     a) Header Files
     b) Resource Files
     c) Source Files
9> Right-click on Source Files and Select Add-> New Item
    Select C++ File, BUT give it a name - "Hello.C"
     [Very important to give a .c extension to the file]
10> Type your code like this:

#include <stdio.h>
int main()
{
    printf("Hello, World!\n");
    return 0;
}

10> Now run/compile the App by pressing CTRL+F5:  If you get a message 
saying the project needs to be built, just click Yes button.






> So with these systems, learning to use the IDE can be as steep a curve 
> as learning the language.
>
> (But I don't think it's been established that that's what the OP is 
> having trouble with.)
>

[toc] | [prev] | [next] | [standalone]


#111589

Frombartc <bc@freeuk.com>
Date2017-06-05 22:58 +0100
Message-ID<YtkZA.42416$J33.4471@fx47.am4>
In reply to#111421
On 03/06/2017 22:15, Real Troll wrote:
> On 03/06/2017 18:59, bartc wrote:

>> While I had it, I tried to get it to compile and run Hello World. 
>> Which I failed to do as well (within ten minutes messing about with it 
>> anyway).

> To edit/create a C program try something like this:
> 
> 1> From the main menu select File -> New -> Project
> 2> In the New Project window select Win32 - Win32 Console Application
> 3> Name your project, and specify a location for your project directory
> 4> Click 'OK', then 'next'
> 5> Select Console application
> 6> Select Empty project
> 7> Deselect Precompiled header - You don't want this for your hello world!
> 8> On the Right hand side you should see three folders:
>      a) Header Files
>      b) Resource Files
>      c) Source Files
> 9> Right-click on Source Files and Select Add-> New Item
>     Select C++ File, BUT give it a name - "Hello.C"
>      [Very important to give a .c extension to the file]
> 10> Type your code like this:
> 
> #include <stdio.h>
> int main()
> {
>     printf("Hello, World!\n");
>     return 0;
> }
> 
> 10> Now run/compile the App by pressing CTRL+F5:  If you get a message 
> saying the project needs to be built, just click Yes button.

OK, thanks; that worked on the second attempt (I had to go back and do 
it again because something must have been left out).

I would never have figured out that lot.

One reason for downloading it again was to see if the preprocessor 
handling had changed much since MSVC-2008. I changed the program to:

#include <stdio.h>
int main()
{
	printf("Hello, World! %X\n", 0x1234e-4 );
	return 0;
}

This prints 1234A for the %X item. But some compilers reject 0x1234e-4 
as a valid expression (ie. 0x1234e minus 4) because they say it's a 
malformed pp token). But if the mighty Visual C doesn't care, then I'm 
not going to either in my own preprocessor.

-- 
bartc

[toc] | [prev] | [next] | [standalone]


#111593

FromKeith Thompson <kst-u@mib.org>
Date2017-06-05 15:51 -0700
Message-ID<lnbmq2kpzo.fsf@kst-u.example.com>
In reply to#111589
bartc <bc@freeuk.com> writes:
[...]
> One reason for downloading it again was to see if the preprocessor 
> handling had changed much since MSVC-2008. I changed the program to:
>
> #include <stdio.h>
> int main()
> {
> 	printf("Hello, World! %X\n", 0x1234e-4 );
> 	return 0;
> }
>
> This prints 1234A for the %X item. But some compilers reject 0x1234e-4 
> as a valid expression (ie. 0x1234e minus 4) because they say it's a 
> malformed pp token).

Those compilers are correct.  It's mildly inconvenient, but it's an
unambiguous consequence of the rules specified in the C standard.

>                      But if the mighty Visual C doesn't care, then I'm 
> not going to either in my own preprocessor.

That's up to you.  If you want your implementation to violate the
standard (because Visual C does so or for any other reason), you're free
to accept `0x1234e-4` without complaint as equivalent to `0x1234e - 4`.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


#111596

Frombartc <bc@freeuk.com>
Date2017-06-06 00:22 +0100
Message-ID<NIlZA.300893$_f2.26881@fx35.am4>
In reply to#111593
On 05/06/2017 23:51, Keith Thompson wrote:
> bartc <bc@freeuk.com> writes:
> [...]
>> One reason for downloading it again was to see if the preprocessor
>> handling had changed much since MSVC-2008. I changed the program to:
>>
>> #include <stdio.h>
>> int main()
>> {
>> 	printf("Hello, World! %X\n", 0x1234e-4 );
>> 	return 0;
>> }
>>
>> This prints 1234A for the %X item. But some compilers reject 0x1234e-4
>> as a valid expression (ie. 0x1234e minus 4) because they say it's a
>> malformed pp token).
> 
> Those compilers are correct.  It's mildly inconvenient, but it's an
> unambiguous consequence of the rules specified in the C standard.
> 
>>                       But if the mighty Visual C doesn't care, then I'm
>> not going to either in my own preprocessor.
> 
> That's up to you.  If you want your implementation to violate the
> standard (because Visual C does so or for any other reason), you're free
> to accept `0x1234e-4` without complaint as equivalent to `0x1234e - 4`.

I'm happy to leave it. Out of 7 compilers I can test (one is mine), 4 
reduce the expression to 0x1234A, 3 report an error. I would assume that 
clang doesn't like it either, then it's 50:50.

Something that contentious doesn't belong in source code. But if it 
slips through in someone's program which then fails on a different 
compiler, then it's easy enough to insert a space.

The 0x1234A result is still the least surprising behaviour, however.


-- 
bartc

[toc] | [prev] | [next] | [standalone]


#111599

Fromsupercat@casperkitty.com
Date2017-06-05 17:05 -0700
Message-ID<1fe9c9fc-4fb0-4c87-a6b5-a8a2107040d2@googlegroups.com>
In reply to#111593
On Monday, June 5, 2017 at 5:51:37 PM UTC-5, Keith Thompson wrote:
> That's up to you.  If you want your implementation to violate the
> standard (because Visual C does so or for any other reason), you're free
> to accept `0x1234e-4` without complaint as equivalent to `0x1234e - 4`.

The Standard allows implementations to provide extensions provided that
they are documented, and provided that they do not alter the behavior of
any Strictly Conforming programs.

Would anything in the Standard forbid an implementation from documenting
that, as an extension, it processes 0x1234e-4 usefully and allows some
specific uses of the token-pasting operator that would otherwise require
diagnostics?  I can't think of any cases where such extensions would alter
the behavior of any programs that wouldn't otherwise violate constraints.

[toc] | [prev] | [next] | [standalone]


#111602

FromKeith Thompson <kst-u@mib.org>
Date2017-06-05 17:57 -0700
Message-ID<ln37bekk5z.fsf@kst-u.example.com>
In reply to#111599
supercat@casperkitty.com writes:
> On Monday, June 5, 2017 at 5:51:37 PM UTC-5, Keith Thompson wrote:
>> That's up to you.  If you want your implementation to violate the
>> standard (because Visual C does so or for any other reason), you're free
>> to accept `0x1234e-4` without complaint as equivalent to `0x1234e - 4`.
>
> The Standard allows implementations to provide extensions provided that
> they are documented, and provided that they do not alter the behavior of
> any Strictly Conforming programs.
>
> Would anything in the Standard forbid an implementation from documenting
> that, as an extension, it processes 0x1234e-4 usefully and allows some
> specific uses of the token-pasting operator that would otherwise require
> diagnostics?  I can't think of any cases where such extensions would alter
> the behavior of any programs that wouldn't otherwise violate constraints.

0x1234e-4 is a constraint violation.  N1570 6.4p2:

    Each preprocessing token that is converted to a token shall have the
    lexical form of a keyword, an identifier, a constant, a string
    literal, or a punctuator.

A conforming implementation must diagnose it.  Once it has done so, it
can do with it as it likes.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


#111391

Fromraltbos@xs4all.nl (Richard Bos)
Date2017-06-03 18:13 +0000
Message-ID<5932fb8b.461468@news.xs4all.nl>
In reply to#111386
Real Troll <real.troll@trolls.com> wrote:

> On 03/06/2017 12:44, Leon Taylor wrote:
> > I have gotten back into programming C after a long Hiatus. Like many of us,
> > I learnt C from the K&R2 but I want to learn modern C (C99/C11).
> > Can any of you recommend a good book/resource?

If you already know C, there is nothing wrong with browsing the newer
Standards. The final draft versions are as near to identical to the
published Standards as makes no practical difference, and they're free.
I keep forgetting where you can download them, but no doubt some other
poster will provide the link. If not, do a websearch for n1256.pdf (C99)
and n1570.pdf (C11).

> You want to start with C#

Don't make me laugh. What does M$-Java have to do with C?

Richard

[toc] | [prev] | [next] | [standalone]


#111445

FromLeon Taylor <leontaylor476@gmail.com>
Date2017-06-03 17:07 -0700
Message-ID<990e1e63-97cf-4d58-af9a-f980ffc2a3d4@googlegroups.com>
In reply to#111391
On Sunday, June 4, 2017 at 4:14:00 AM UTC+10, Richard Bos wrote:
> Real Troll <real.troll@trolls.com> wrote:
> 
> > On 03/06/2017 12:44, Leon Taylor wrote:
> > > I have gotten back into programming C after a long Hiatus. Like many of us,
> > > I learnt C from the K&R2 but I want to learn modern C (C99/C11).
> > > Can any of you recommend a good book/resource?
> 
> If you already know C, there is nothing wrong with browsing the newer
> Standards. The final draft versions are as near to identical to the
> published Standards as makes no practical difference, and they're free.
> I keep forgetting where you can download them, but no doubt some other
> poster will provide the link. If not, do a websearch for n1256.pdf (C99)
> and n1570.pdf (C11).
> 
> > You want to start with C#
> 
> Don't make me laugh. What does M$-Java have to do with C?
> 
> Richard

Thanks Richard, I will look into finding those. I have no doubt that they will be very useful. 

[toc] | [prev] | [next] | [standalone]


#111447

FromKeith Thompson <kst-u@mib.org>
Date2017-06-03 18:20 -0700
Message-ID<ln1sr0mtu4.fsf@kst-u.example.com>
In reply to#111391
raltbos@xs4all.nl (Richard Bos) writes:
[...]
> If you already know C, there is nothing wrong with browsing the newer
> Standards. The final draft versions are as near to identical to the
> published Standards as makes no practical difference, and they're free.
> I keep forgetting where you can download them, but no doubt some other
> poster will provide the link. If not, do a websearch for n1256.pdf (C99)
> and n1570.pdf (C11).

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


#111450

FromLeon Taylor <leontaylor476@gmail.com>
Date2017-06-03 19:59 -0700
Message-ID<adc7637a-0697-4791-981b-b1e0f5ae2acb@googlegroups.com>
In reply to#111447
On Sunday, June 4, 2017 at 11:20:59 AM UTC+10, Keith Thompson wrote:
> raltbos@xs4all.nl (Richard Bos) writes:
> [...]
> > If you already know C, there is nothing wrong with browsing the newer
> > Standards. The final draft versions are as near to identical to the
> > published Standards as makes no practical difference, and they're free.
> > I keep forgetting where you can download them, but no doubt some other
> > poster will provide the link. If not, do a websearch for n1256.pdf (C99)
> > and n1570.pdf (C11).
> 
> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
> 
> -- 
> Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
> Working, but not speaking, for JetHead Development, Inc.
> "We must do something.  This is something.  Therefore, we must do this."
>     -- Antony Jay and Jonathan Lynn, "Yes Minister"

Thank you very much. These are just what I was looking for.

[toc] | [prev] | [next] | [standalone]


#111394

FromGOTHIER Nathan <nathan.gothier@gmail.com>
Date2017-06-03 20:39 +0200
Message-ID<20170603203938.7cfff53de597898ba5849b08@gmail.com>
In reply to#111386
On Sat, 3 Jun 2017 13:30:00 -0400
Real Troll <real.troll@trolls.com> wrote:

> Apart from this, you just need to search the web for certain topics or 
> if you want something that goes step by step then you need a book.  
> Experience tells me that people rarely read a book these days as they 
> want to do things from the word go.  Theory is for the classroom not for 
> learning purposes how to do things.

Most of the time it's better to read a reference book than trolls on
Usenet... :-)

[toc] | [prev] | [next] | [standalone]


#111419

FromBarry Schwarz <schwarzb@dqel.com>
Date2017-06-03 14:01 -0700
Message-ID<0r86jc9fe8iqesndbomnbc4d3ajqqju5s2@4ax.com>
In reply to#111386
On Sat, 3 Jun 2017 13:30:00 -0400, Real Troll <real.troll@trolls.com>
wrote:

>You want to start with C# as by default Microsoft Visual Studio doesn't 
>support C 

That's going to be a real shock to those of us who are using it for C
without any thought of C++ or C#.

-- 
Remove del for email

[toc] | [prev] | [next] | [standalone]


#111446

FromLeon Taylor <leontaylor476@gmail.com>
Date2017-06-03 17:08 -0700
Message-ID<fb45f0fb-c8b9-4d2a-93b5-91ae6f60ff61@googlegroups.com>
In reply to#111386
On Sunday, June 4, 2017 at 3:25:52 AM UTC+10, Real Troll wrote:
> On 03/06/2017 12:44, Leon Taylor wrote:
> > Hi everyone,
> > I have gotten back into programming C after a long Hiatus. Like many of us, I learnt C from the K&R2 but I want to learn modern C (C99/C11).
> > Can any of you recommend a good book/resource?
> > Thanks, Leon.
> 
> You want to start with C# as by default Microsoft Visual Studio doesn't 
> support C but this doesn't mean you can't create a C program on it.  
> However, C# is in the vogue these days or even Embarcadero Delphi.
> 
> you can both MS Visual Studio Community Edition and Delphi Starter 
> Edition free of charge.  (you also get C++ starter Edition as well free)
> 
> Apart from this, you just need to search the web for certain topics or 
> if you want something that goes step by step then you need a book.  
> Experience tells me that people rarely read a book these days as they 
> want to do things from the word go.  Theory is for the classroom not for 
> learning purposes how to do things.

Emacs + GCC is good enough for me lol

[toc] | [prev] | [next] | [standalone]


Page 2 of 5 — ← Prev page 1 [2] 3 4 5  Next page →

Back to top | Article view | comp.lang.c


csiph-web