Go to advanced search

by jahboater
Sun Jul 21, 2019 11:27 pm
Forum: C/C++
Topic: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?
Replies: 255
Views: 5646

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

PeterO wrote:
Sun Jul 21, 2019 10:56 am
On modern machines I rarely add more that a dozen lines of code without testing.
Sensible. Then, if things break, its easy to find the change that caused the problem.
by jahboater
Sun Jul 21, 2019 10:02 am
Forum: C/C++
Topic: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?
Replies: 255
Views: 5646

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

jalih wrote:
Sun Jul 21, 2019 9:57 am
But can C do this:

Code: Select all

int32_t big, little;

little = 255;

big = __builtin_bswap32(little);

Or vice-versa;
It will be done in a single instruction on x86 and ARM.  

Although not in the standard, most compilers will accept it.
by jahboater
Sun Jul 21, 2019 9:45 am
Forum: C/C++
Topic: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?
Replies: 255
Views: 5646

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

With edit/compile/test cycles easily taking 15 minutes you quickly learn to plan out your code rather than "designing at the keyboard" which seems to be popular these days. I must respectfully disagree with this. I have worked on big codebases which indeed took over 10 minutes to compile, When I wa...
by jahboater
Sun Jul 21, 2019 9:33 am
Forum: C/C++
Topic: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?
Replies: 255
Views: 5646

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

And a good sprinkling of assertions. Take a look at static_assert() by the way. Its been in C since C11 but I have only recently started using it. static_assert( __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__, "The byte order must be little endian (use -mlittle-endian)" ); static_assert( sizeof(int) == ...
by jahboater
Sun Jul 21, 2019 8:49 am
Forum: C/C++
Topic: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?
Replies: 255
Views: 5646

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Heater, What if I define "getting the job done" such that it include some rigorous guarantees of correctness? After all, we don't want the job to be done incorrectly or badly. Or not get the job done at all. I don't see much (by comparison) very large scale software written in Ada or Pascal or whate...
by jahboater
Sun Jul 21, 2019 8:22 am
Forum: C/C++
Topic: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?
Replies: 255
Views: 5646

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Heater wrote:
Sun Jul 21, 2019 8:14 am
1) Integer overflow.
2) Out bounds array access.
3) Use of random pointer values.
Add run-time checks for all that stuff and it would be as slow as Python ...
by jahboater
Sun Jul 21, 2019 8:19 am
Forum: C/C++
Topic: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?
Replies: 255
Views: 5646

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

No, whether using pointers or arrays one should define ones data structure properly, then write functions that do all the access to that data, read, write, update, delete, etc. Those data access functions can then check for array bounds, wayward pointers etc. Those access routines isolate the "dang...
by jahboater
Sun Jul 21, 2019 7:51 am
Forum: C/C++
Topic: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?
Replies: 255
Views: 5646

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

• The reasons why Pascal can't be used for serious programming is outlined by Brian Kernighan here . Interesting paper. Comparing C and Pascal is rather like comparing a Learjet to a Piper Cub - one is meant for getting something done while the other is meant for learning In general, if you want to...
by jahboater
Sun Jul 21, 2019 7:32 am
Forum: Bare metal, Assembly language
Topic: Using the NEON vmvn instruction
Replies: 3
Views: 172

Re: Using the NEON vmvn instruction

Thanks,

It doesn't like that either :(

Error: operand 1 must be an integer register -- `mvn q0,q0'

Edit:

Looks like the intrinsic vmvnq_u8() emits NOT v0.16b,v0.16b which works, but disagrees with the ARMv8_ARM, or at least my copy of it. Without the V prefix as you suggested.
by jahboater
Sat Jul 20, 2019 10:21 pm
Forum: Bare metal, Assembly language
Topic: Using the NEON vmvn instruction
Replies: 3
Views: 172

Using the NEON vmvn instruction

I want to invert 256 bits in memory, so I tried:-

Code: Select all

ldp  q0,q1,[x0]
vmvn q0,q0
vmvn q1,q1
stp  q0,q1,[x0]
But the assembler is rejecting it (called inline from C).

Error: unknown mnemonic `vmvn' -- `vmvn q0,q0'

Yet its in the ARMv8_ARM.

Is this a bug or have I missed something obvious?
by jahboater
Sat Jul 20, 2019 7:12 pm
Forum: Other programming languages
Topic: ScriptBasic
Replies: 1316
Views: 42553

Re: ScriptBasic

Wow, what? I once designed a board with an 8086 and 8087 on it. Had a whole tube of 8087s. No idea what happened to them. There was also space for an 8089 IO coprocessor. That is so rare we never actually got hold of one when they were current! People made ear-rings out of 186's (those with a purpl...
by jahboater
Sat Jul 20, 2019 5:03 pm
Forum: C/C++
Topic: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?
Replies: 255
Views: 5646

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Sorry, I took your "yes" above to be an affirmative answer to my question "...have you actually seen the source code of the Windows kernel?" I presume now that it was not. Correct, sorry. Used to have the UNIX source code back in the "version 7" days (educational license, Amdahl UTS), and the IBM V...
by jahboater
Sat Jul 20, 2019 2:08 pm
Forum: General discussion
Topic: Raspberry pi for coding on machine level?
Replies: 18
Views: 551

Re: Raspberry pi for coding on machine level?

I am impressed at the interest. Not many want to use machine language anymore. There are still a lot of Assembly Language coders out there, though very few Machine Language programmers. I "think" the OP meant assembler. I have programmed Z80's over the years in hex, and wouldn't wish it on my worst...
by jahboater
Sat Jul 20, 2019 1:41 pm
Forum: RISCOS
Topic: Your Pi Zero config
Replies: 6
Views: 183

Re: Your Pi Zero config

Deleted
by jahboater
Sat Jul 20, 2019 1:29 pm
Forum: General discussion
Topic: Raspberry pi for coding on machine level?
Replies: 18
Views: 551

Re: Raspberry pi for coding on machine level?

If you want to learn Assembler to use on one particular system, you may want to concentrate on that. x86_64 is CISC, ARM and especially A64 (the Pi in 64-bit mode) are RISC. Quite different to learn. But if you like assembler, and are interested in it, then it may be worth learning both. Its all go...
by jahboater
Sat Jul 20, 2019 11:10 am
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 479
Views: 18427

Re: Introduction to BBC BASIC

ejolson wrote:
Sat Jul 20, 2019 11:04 am
The obvious drawback is not being able to store the NULL character
"abc\0def" is valid of course - if you know what you are doing and have some strange reason for it!

Its often handy to be be able to quickly truncate a string with: str[n] = '\0';
by jahboater
Sat Jul 20, 2019 11:01 am
Forum: C/C++
Topic: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?
Replies: 255
Views: 5646

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Heater wrote:
Sat Jul 20, 2019 10:19 am
Wow, amazing, how did that happen?
How did what happen?

If you are talking about relative dates, then things like OS's and surrounding software evolve over time.
by jahboater
Sat Jul 20, 2019 10:21 am
Forum: Other programming languages
Topic: Introduction to BBC BASIC
Replies: 479
Views: 18427

Re: Introduction to BBC BASIC

Given the tiny amounts of memory the machines C was developed on, and the desire for strings of any length it makes sense to do what C did, don't store the length and put a null on the end. Which takes one byte regardless of the length. Also the strings value in an expression is the address of the ...
by jahboater
Sat Jul 20, 2019 9:58 am
Forum: C/C++
Topic: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?
Replies: 255
Views: 5646

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Heater wrote:
Sat Jul 20, 2019 9:50 am
By the way, have you actually seen the source code of the Windows kernel? I suspect it's actually C. Or was when it was created. C++ was not a thing until 1998.
Yes. I believe Windows is 98% C, with a little C++ and a tiny amount of C#
by jahboater
Sat Jul 20, 2019 9:00 am
Forum: General discussion
Topic: Raspberry pi for coding on machine level?
Replies: 18
Views: 551

Re: Raspberry pi for coding on machine level?

As a side note, Would you recommend learning to program on a Raspberry Pi, or on an old Windows laptop? Are there many differences between coding on Python, or C++ in Linux (on a Pi) vs coding on an old Windows laptop? My personal opinion is that its much easier on the Pi (compared to Windows). Lin...
by jahboater
Sat Jul 20, 2019 8:48 am
Forum: General discussion
Topic: Raspberry pi for coding on machine level?
Replies: 18
Views: 551

Re: Raspberry pi for coding on machine level?

I have some debugging tips for you: Try also "layout reg" (or just "la r" for short). This splits the screen into three windows. The top window contains the registers and their values with the last changed register highlighted. The middle window contains the assembler with the next instruction high...
by jahboater
Sat Jul 20, 2019 8:30 am
Forum: General discussion
Topic: Raspberry pi for coding on machine level?
Replies: 18
Views: 551

Re: Raspberry pi for coding on machine level?

Thanks for the quick and informative response! Is there a sort of community where examples like these can be found, and where people can share their experiences (more for beginners; and specific to the Pi)? This forum is a great place for help and chat about Pi specific issues. Beginners are welcom...
by jahboater
Sat Jul 20, 2019 8:12 am
Forum: General discussion
Topic: Raspberry pi for coding on machine level?
Replies: 18
Views: 551

Re: Raspberry pi for coding on machine level?

Assuming by "machine code level" you mean assembly language, then yes the Pi is great for that. The official OS called Raspbian comes with an excellent assembler already installed and ready to use. https://www.raspberrypi.org/downloads/raspbian/ Also included is a C/C++ compiler called GCC. You may ...
by jahboater
Fri Jul 19, 2019 11:51 pm
Forum: C/C++
Topic: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?
Replies: 255
Views: 5646

Re: I dont get it... Why is everyone from science schools so obsessed with Perl and Python when we got C?

Then allow for extra optimizations to be applied only to portions of the code that it makes good since to so do with, as specified by the programmer. GCC can do that now. The programmer may specify that a function is either "hot" or "cold". The branch prediction stuff for cold is interesting. cold ...
by jahboater
Fri Jul 19, 2019 9:12 am
Forum: C/C++
Topic: sched: RT throttling activated
Replies: 3
Views: 86

Re: sched: RT throttling activated

Then there is the "vcgencmd" that will show if thermal throttling has happened: $ /opt/vc/bin/vcgencmd get_throttled It will also show if there have been low voltage problems too. There is a bit saying its currently throttled and another sticky bit saying its throttled in the past (since the last b...

Go to advanced search