Author Topic: Pointer confusion in C -language  (Read 21878 times)

0 Members and 2 Guests are viewing this topic.

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: Pointer confusion in C -language
« Reply #175 on: July 22, 2021, 11:41:58 pm »
I was never a fan of "teaching languages" because you basically leave university having learnt little that's actually useful anyway, and not learning useful "computing stuff" makes it even worse.

I designed a function generator which drove a 256 byte fusible link PROM from an 8-bit sync counter and fed its output into an 8-bit DAC (state of the art stuff in 1978!) and I needed to generate the binary data to program into the PROM (setting up every byte with toggle switches on the programmer!). So, to generate a sinewave, I wanted a program which would print out sin(x), with x going 0-255 representing 0-360deg, and the value going 0-255. In Pascal. Impossible! Nobody knew how to write it. I did it in Fortran...

I have no idea why you think that would be impossible or even difficult in Pascal in 1978. It would be trivial in BASIC on a TRS-80, or Apple ][, or Commodore Pet in 1978, and no more difficult in Pascal.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14447
  • Country: fr
Re: Pointer confusion in C -language
« Reply #176 on: July 22, 2021, 11:45:12 pm »
I was never a fan of "teaching languages" because you basically leave university having learnt little that's actually useful anyway, and not learning useful "computing stuff" makes it even worse.

I designed a function generator which drove a 256 byte fusible link PROM from an 8-bit sync counter and fed its output into an 8-bit DAC (state of the art stuff in 1978!) and I needed to generate the binary data to program into the PROM (setting up every byte with toggle switches on the programmer!). So, to generate a sinewave, I wanted a program which would print out sin(x), with x going 0-255 representing 0-360deg, and the value going 0-255. In Pascal. Impossible! Nobody knew how to write it. I did it in Fortran...

I have no idea why you think that would be impossible or even difficult in Pascal in 1978. It would be trivial in BASIC on a TRS-80, or Apple ][, or Commodore Pet in 1978, and no more difficult in Pascal.

Ditto?
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 3911
  • Country: gb
Re: Pointer confusion in C -language
« Reply #177 on: July 23, 2021, 12:02:47 am »
MicroPascal is used in embedded :D
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: Pointer confusion in C -language
« Reply #178 on: July 23, 2021, 03:39:25 am »
I was never a fan of "teaching languages" because you basically leave university having learnt little that's actually useful anyway, and not learning useful "computing stuff" makes it even worse.

I designed a function generator which drove a 256 byte fusible link PROM from an 8-bit sync counter and fed its output into an 8-bit DAC (state of the art stuff in 1978!) and I needed to generate the binary data to program into the PROM (setting up every byte with toggle switches on the programmer!). So, to generate a sinewave, I wanted a program which would print out sin(x), with x going 0-255 representing 0-360deg, and the value going 0-255. In Pascal. Impossible! Nobody knew how to write it. I did it in Fortran...

I have no idea why you think that would be impossible or even difficult in Pascal in 1978. It would be trivial in BASIC on a TRS-80, or Apple ][, or Commodore Pet in 1978, and no more difficult in Pascal.

See for example page 23 of the 1976 Pascal classic "Algorithms + Data Structures = Programs", where we see real variables used with sqrt, sin, cos.

https://doc.lagout.org/science/0_Computer%20Science/2_Algorithms/Algorithms%20%20%20Data%20Structures%20%3D%20Programs%20%5BWirth%201976-02%5D.pdf

Plus of course you can convert real to integer, do div and mod on integers to get hex digits, chr() to convert ASCII codes to char etc etc. I don't see any obstacle to doing trig calculations and printing the results as 0..255 or 00..FF or in binary if you want. In Pascal circa 1972-1976.
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2803
  • Country: nz
Re: Pointer confusion in C -language
« Reply #179 on: July 23, 2021, 05:12:38 am »
I don't see any obstacle to doing trig calculations and printing the results as 0..255 or 00..FF or in binary if you want. In Pascal circa 1972-1976.

Maybe the documentation was lacking  :D.

We quickly forget how hard it was to find good documentation for dev tools in the early years, and what a revelation/revolution "man" pages were.

One of my first holiday jobs was data entry into a mainframe database all of a bank's IBM publications, as then updating manuals in 3-ring binders with corrected pages - and that was mid 80s!
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14447
  • Country: fr
Re: Pointer confusion in C -language
« Reply #180 on: July 23, 2021, 06:05:46 pm »
As I said, I personally think that the best languages for teaching programming are those that are specifically designed for this task. In CS teaching history, if you think about it, the languages that were most successful for teaching all were designed in universities, often by professors and their teams. OTOH, those languages were often not quite fit for "industrial use", so to speak. Conversely, languages designed in industrial settings have been a better fit for real-world use, but poorer for teaching. Yes, even Java - I'm not very fond of it, and I'm not too convinced it's all that good for teaching. Sure there are worse alternatives out there. Python is definitely one IMO.

Python has the very great advantage over Java of being able to write a simple program e.g. HelloWorld in a single line of code, without ten lines of boilerplate code that that won't be and can't be explained until you know much more about the language. C is worse than Python in that, but a lot better than Java.

Well, frankly, if all it has going for it is that it will take a couple fewer lines to write an Hello World program, huh...  ;D
Sure some languages just take a one-liner for this. Basic was one of them. That doesn't make them particularly good languages as such. I understand that it makes the very first hours of learning programming, for someone who has never been exposed to it, easier.

Otherwise, I agree with your other points about Python.
I personally sum up my view of it like so: Python is a great tool, but very poor as a programming language. Teaching it as a now widely-used tool is fine. Using it for teaching the fundamentals of programming and good programming practices is uh... not.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf