Skip to content
Tcl Source Code View Ticket
Login

View Ticket

TCL_DEFS has SPC if "long long" allowed

Closed531931ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2002-03-19 16:47:29
On my Linux box with 64-bit support, the TCL_DEFS 
variable definition in tclConfig.sh has the form:

  TCLDEFS=' .... -Dblah=long\ long ...'

That is extremely hard to use in shell scripts 
(impossible?), because the quoting gets lost.  The 
following test script fails, when run in tcl/unix/:

  . tclConfig.sh
  gcc -c $TCL_DEFS tclAppInit.c

The error is that it loses the backslash, and 
complains about not finding the source file named 
"long".

I've tried all sorts of quoting tactics, to no avail.

One workaround is to add the following to tcl.h:
#define TCL_LONGLONG long long
Then, alter the logic to emit the following to 
tclCobfig.sh instead:

  TCLDEFS=' .... -Dblah=TCL_LONGLONG ...'

There's also a "int64_t" defined on Linux in 
"stdint.h", but that file is probably not available 
everywhere.
hobbsplain2002-03-23 04:41:06
Logged In: YES 
user_id=72656

int64_t can't be used because it's a typedef that cannot 
be "unsigned", and then you have to check for an unsigned 
64-bit type.

The way that the TEA stuff uses TCL_DEFS doesn't seem to 
worry about the fact that it's defined as 'long\ long', 
perhaps pointers for your build system can be taken from 
there?
jcw Closed ticket [531931ffff]. [History diff]2002-03-23 05:28:41
jcwplain2002-03-23 05:28:42
Logged In: YES 
user_id=1983

I was trying to suggest a simpler solution, but I suppose the 
tradeoff is debatable.

Yes, I've worked around this in the way I now build things.

Thanks.
hobbsplain2002-03-23 05:31:18
Logged In: YES 
user_id=72656

I think the problem is that the "unquoted" version that is 
used by Tcl is what is needed for it to work in the C 
code.  #defines are a capricious thing.
Log in (anonymous is fine) to add a comment.