Recent

Author Topic: C/C ++ methods disable  (Read 521 times)

Seenkao

  • Full Member
  • ***
  • Posts: 157
C/C ++ methods disable
« on: April 24, 2021, 07:58:36 pm »
Как отключить +=, -=, /=, *= глобально? Чтоб я мог видеть вылетающую ошибку при компиляции. Мне не удобны не визуальные методы при чтении кода. Отключение в проекте не помогает.

google translate: How to disable + =, - =, / =, * = globally? So that I can see the crashing error during compilation. I am not comfortable with non-visual methods when reading code. Disconnecting in a project doesn't help.

Lazarus 2.1.0

Please redirect to the appropriate section. Somehow I missed ...
« Last Edit: April 24, 2021, 08:06:33 pm by Seenkao »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 870
Re: C/C ++ methods disable
« Reply #1 on: April 24, 2021, 08:22:25 pm »
Add the compiler option -Sc-

Seenkao

  • Full Member
  • ***
  • Posts: 157
Re: C/C ++ methods disable
« Reply #2 on: April 24, 2021, 09:35:22 pm »
Disconnecting in a project doesn't help.
Add the compiler option -Sc-
And that too. And that too. And, I need it globally!
the project compiles without errors when I remove this option.
« Last Edit: April 24, 2021, 09:36:54 pm by Seenkao »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 870
Re: C/C ++ methods disable
« Reply #3 on: April 24, 2021, 09:37:06 pm »
-Sc is part of the default fpc.cfg file, so it's always enabled by default. If you wish to disable it for yourself, you can either edit the fpc.cfg file and remove/comment that line (but remember you will have to do it again when you upgrade), or if you are on a Unix-like platform, you can create a file call .fpc.cfg (note the starting ".") in your home directory with the following contents:

Code: [Select]
#include /etc/fpc.cfg
-Sc-

I don't know if you can do something similar on Windows.
« Last Edit: April 24, 2021, 09:39:23 pm by Jonas Maebe »

Seenkao

  • Full Member
  • ***
  • Posts: 157
Re: C/C ++ methods disable
« Reply #4 on: April 24, 2021, 10:30:47 pm »
Quote from: fpc.cfg
# Automatically created file, don't edit.
#IFDEF NORMAL
 -TLinux
 -Mfpc
 -Sg
 -Ci
 -CpATHLON64
 -OpATHLON64
 -Fu/home/mirrel/fpc_3_2/fpc\units\$fpctarget
 -Fu/home/mirrel/fpc_3_2/fpc\units\$fpctarget\*
 -Fu/home/mirrel/fpc_3_2/fpc\units\$fpctarget\rtl
 -Fl/usr/lib/gcc/x86_64-linux-gnu/8
 -Fl/usr/lib/gcc/x86_64-linux-gnu/8
 -XS
 -g-
 -p-
 -b-
 
 -O1
#ENDIF

#IFDEF DEBUG
 -TLinux
 -Mfpc
 -Sg
 -Cr
 -Ci
 -Co
 -CpATHLON64
 -OpATHLON64
 -Fu/home/mirrel/fpc_3_2/fpc\units\$fpctarget
 -Fu/home/mirrel/fpc_3_2/fpc\units\$fpctarget\*
 -Fu/home/mirrel/fpc_3_2/fpc\units\$fpctarget\rtl
 -Fl/usr/lib/gcc/x86_64-linux-gnu/8
 -Fl/usr/lib/gcc/x86_64-linux-gnu/8
 -XS
 -g
 -p-
 -b-
#ENDIF

#IFDEF RELEASE
 -TLinux
 -Mfpc
 -Sg
 -CpATHLON64
 -OpATHLON64
 -Fu/home/mirrel/fpc_3_2/fpc\units\$fpctarget
 -Fu/home/mirrel/fpc_3_2/fpc\units\$fpctarget\*
 -Fu/home/mirrel/fpc_3_2/fpc\units\$fpctarget\rtl
 -Fl/usr/lib/gcc/x86_64-linux-gnu/8
 -Fl/usr/lib/gcc/x86_64-linux-gnu/8
 -XS
 -g-
 -p-
 -b-
 
 -O2
#ENDIF
-Sc- not found!

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 870
Re: C/C ++ methods disable
« Reply #5 on: April 24, 2021, 10:34:13 pm »
Indeed, you're right. So in that case it is disabled by default. I don't understand your question then though.

Seenkao

  • Full Member
  • ***
  • Posts: 157
Re: C/C ++ methods disable
« Reply #6 on: April 24, 2021, 11:12:56 pm »
если в коде присутствуют +=, -= он компилируется и не выдаёт ошибок.
google translate: if the code contains +=, -= it compiles and does not give errors.

lucamar

  • Hero Member
  • *****
  • Posts: 4009
Re: C/C ++ methods disable
« Reply #7 on: April 24, 2021, 11:41:52 pm »
.
если в коде присутствуют +=, -= он компилируется и не выдаёт ошибок.
google translate: if the code contains +=, -= it compiles and does not give errors.

Look again into your /etc/fpc.cfg and you will probably find it's there, probably inside a "combined" -S  line like e.g. (from mine, which  is the default one):
Code: Text  [Select][+][-]
  1. # Allow goto, inline, C-operators, C-vars
  2. -Sgic

Create or edit:
~/.fpc.cfg
and add a line at the end with:
Code: [Select]
-Sc-
or, if creating it, with what Jonas showed above
« Last Edit: April 24, 2021, 11:45:00 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Seenkao

  • Full Member
  • ***
  • Posts: 157
Re: C/C ++ methods disable
« Reply #8 on: April 25, 2021, 12:24:24 am »
Благодарю!
Это я не тот файл смотрел.
google translate: Thank you!
I looked at the wrong file.  :-[

 

TinyPortal © 2005-2018